From patchwork Fri Jul 27 14:03:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10547209 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7DA0514E0 for ; Fri, 27 Jul 2018 14:03:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B4A028795 for ; Fri, 27 Jul 2018 14:03:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E1B22BC39; Fri, 27 Jul 2018 14:03:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D123D2BC41 for ; Fri, 27 Jul 2018 14:03:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C68D6B0269; Fri, 27 Jul 2018 10:03:35 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8FCFB6B000E; Fri, 27 Jul 2018 10:03:35 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 79FF36B0266; Fri, 27 Jul 2018 10:03:35 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by kanga.kvack.org (Postfix) with ESMTP id 1C3646B000E for ; Fri, 27 Jul 2018 10:03:35 -0400 (EDT) Received: by mail-wr1-f71.google.com with SMTP id w2-v6so3310164wrt.13 for ; Fri, 27 Jul 2018 07:03:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=09jE8HQnR78gKgCVm3YT0g0xgTev+DzLs5mljNQWB3Y=; b=GFVoVJjs6isq2AzKKaYmx3StwbqKUJT0RQsC4L9YcKpaQL9GC15TVoG7CaOqJytTNp hR4gGw+m8vd9UKI4sjF6kpGGT+vIszfjRw8uFr67/X5ZUL8YuM5Jfx4+cR034YoCLtkC iociJ5RBOv1t+iZiKPSvwGkG6TTpqYldScgV3xow+UR0m8go6RznP7f+eOdbva6AliYq VQWf/7hHdOwY2S5UU8C/+QIWvsdHlz6FXXDyXwXjiozsujeb1lRKeBtvqVr1wfrfp0Ry JZ6vQJZ1/brR+V1fffLLfNG2POARADObZr8HYVOyrxnNpiW2BNS4tPWwxbCjqgiCPvhr d9Ig== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Gm-Message-State: AOUpUlF6KxusncJdgwBo9/w7JjCa0mX7kZzDcPe5+IZ3RllrT2lfquqY 0ZxENY4+Vz8f22tTtxO/pWT0nh3uki+BTIJVrkKsQZ8IKwBEG2T64FErVjIeh0ULWj2Ufau/s3k 8AVutjjqqnAGk1nhXnL0EW1ry3+gCdu0HprgIBH0h87MoUBhNM4370RLMpkMsfbr4mzuJr2gWCt 1iTaxpjo8XAJuwzFGfT6fZkXeYCG9O/c34N7jbfX1DQC+JbvZUHWoQ+aaUTJp97BBafAcUa4kge eXY0GugTjcpM7FOCVLDd/pE3Obifj0cQ0maydwBfMZifnQFdEp4AtLJwgKFuhIK9tNrWQrmnuJc eLWnfhYmG1bWH4ej8++V8hJxQl2GBimpXzMO/WFcb5MmmVWePQcl3tjkgh0/Pmy0JgSWbNDkYQ= = X-Received: by 2002:adf:8296:: with SMTP id 22-v6mr4808729wrc.252.1532700214665; Fri, 27 Jul 2018 07:03:34 -0700 (PDT) X-Received: by 2002:adf:8296:: with SMTP id 22-v6mr4808689wrc.252.1532700214003; Fri, 27 Jul 2018 07:03:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532700213; cv=none; d=google.com; s=arc-20160816; b=gtIkrcOFA/nvMMbGQnU2Lrjcbj3Om5H6v355Ny4pA5+TvZq4C2R4b0gyxzMGO5clT1 FN90M142C6wkpmPnFW0J2biePE/2bhq8fr9cDie2uNmH4ZBVJVahdMCIGAroSzQqkgIV tNX2qrXD5MC45x7B3zWQS533Iea+Z1BB6RNGLZJGj7a1DeNYytdIa8fPr5ioMV5+6WM0 0JYvePA2Onkr2hNZi//+HmYoePKGzSK4sNCgOPzxDc7fzH8ZPyPAR5cCz1XT+oPd6Eyx y6o228dXwNpS8FDP7qK8hv9byd+140E4D7n7GUq1kubf8U7+XfpAGFuT1pditFcZmkhS /v0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=09jE8HQnR78gKgCVm3YT0g0xgTev+DzLs5mljNQWB3Y=; b=z7IYgiHNqhkk0MyCCy3RMGQQ79Nqj9qfTBC+2jVVNnM9xYztW2AoizLFaCfVe0K4CJ EfyXysa8/uzMmtYT/jX06Srsz9mryYhxQl5zLwZ0f6D7uz/DVqJBBN54uIFp5APPE2el K480zdVth08TidJy6D4ROC+Ep4rGGAAV/9F/+DeWEL6Dc73sYD85bATe/CAfupL7H5lA aQMpXnYvaOrTNbAZXB97niHoOXpgMqt7EP8+rn288JmzpZz5Qp7jp5Nhh66Ym6QxSvZ9 HwMSlGz3Sua7ImHQCXmPdLY02RJ96OMmGmWOGgpCpIsxxio1Ti4tmleCHwReKJER+UJ/ Grqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id o7-v6sor910116wmh.47.2018.07.27.07.03.33 for (Google Transport Security); Fri, 27 Jul 2018 07:03:33 -0700 (PDT) Received-SPF: pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Google-Smtp-Source: AAOMgpfnYfgeyb1lK5pdIFr1c+xnkt449YTC2ibUtk9nV1wQnfxsctvKIEdyZI/Vfl6LGJmQDXsxCQ== X-Received: by 2002:a1c:9215:: with SMTP id u21-v6mr4315769wmd.106.1532700213727; Fri, 27 Jul 2018 07:03:33 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id n17-v6sm3453450wmc.13.2018.07.27.07.03.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jul 2018 07:03:32 -0700 (PDT) Received: from d104.suse.de (nat.nue.novell.com [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id 71EC5124405; Fri, 27 Jul 2018 16:03:31 +0200 (CEST) From: osalvador@techadventures.net To: akpm@linux-foundation.org Cc: mhocko@suse.com, vbabka@suse.cz, pasha.tatashin@oracle.com, mgorman@techsingularity.net, aaron.lu@intel.com, iamjoonsoo.kim@lge.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, dan.j.williams@intel.com, Oscar Salvador Subject: [PATCH v4 1/4] mm/page_alloc: Move ifdefery out of free_area_init_core Date: Fri, 27 Jul 2018 16:03:22 +0200 Message-Id: <20180727140325.11881-2-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180727140325.11881-1-osalvador@techadventures.net> References: <20180727140325.11881-1-osalvador@techadventures.net> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Oscar Salvador Moving the #ifdefs out of the function makes it easier to follow. Signed-off-by: Oscar Salvador Acked-by: Michal Hocko Reviewed-by: Pavel Tatashin --- mm/page_alloc.c | 50 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e357189cd24a..8a73305f7c55 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6206,6 +6206,37 @@ static unsigned long __paginginit calc_memmap_size(unsigned long spanned_pages, return PAGE_ALIGN(pages * sizeof(struct page)) >> PAGE_SHIFT; } +#ifdef CONFIG_NUMA_BALANCING +static void pgdat_init_numabalancing(struct pglist_data *pgdat) +{ + spin_lock_init(&pgdat->numabalancing_migrate_lock); + pgdat->numabalancing_migrate_nr_pages = 0; + pgdat->numabalancing_migrate_next_window = jiffies; +} +#else +static void pgdat_init_numabalancing(struct pglist_data *pgdat) {} +#endif + +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +static void pgdat_init_split_queue(struct pglist_data *pgdat) +{ + spin_lock_init(&pgdat->split_queue_lock); + INIT_LIST_HEAD(&pgdat->split_queue); + pgdat->split_queue_len = 0; +} +#else +static void pgdat_init_split_queue(struct pglist_data *pgdat) {} +#endif + +#ifdef CONFIG_COMPACTION +static void pgdat_init_kcompactd(struct pglist_data *pgdat) +{ + init_waitqueue_head(&pgdat->kcompactd_wait); +} +#else +static void pgdat_init_kcompactd(struct pglist_data *pgdat) {} +#endif + /* * Set up the zone data structures: * - mark all pages reserved @@ -6220,21 +6251,14 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat) int nid = pgdat->node_id; pgdat_resize_init(pgdat); -#ifdef CONFIG_NUMA_BALANCING - spin_lock_init(&pgdat->numabalancing_migrate_lock); - pgdat->numabalancing_migrate_nr_pages = 0; - pgdat->numabalancing_migrate_next_window = jiffies; -#endif -#ifdef CONFIG_TRANSPARENT_HUGEPAGE - spin_lock_init(&pgdat->split_queue_lock); - INIT_LIST_HEAD(&pgdat->split_queue); - pgdat->split_queue_len = 0; -#endif + + pgdat_init_numabalancing(pgdat); + pgdat_init_split_queue(pgdat); + pgdat_init_kcompactd(pgdat); + init_waitqueue_head(&pgdat->kswapd_wait); init_waitqueue_head(&pgdat->pfmemalloc_wait); -#ifdef CONFIG_COMPACTION - init_waitqueue_head(&pgdat->kcompactd_wait); -#endif + pgdat_page_ext_init(pgdat); spin_lock_init(&pgdat->lru_lock); lruvec_init(node_lruvec(pgdat));