From patchwork Mon Jul 30 10:17:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10548855 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 BC38F14BC for ; Mon, 30 Jul 2018 10:18:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA09329703 for ; Mon, 30 Jul 2018 10:18:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E0FB29706; Mon, 30 Jul 2018 10:18:10 +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 358B229703 for ; Mon, 30 Jul 2018 10:18:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 591BD6B0005; Mon, 30 Jul 2018 06:18:06 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 563AA6B0006; Mon, 30 Jul 2018 06:18:06 -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 451966B0008; Mon, 30 Jul 2018 06:18:06 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f69.google.com (mail-wm0-f69.google.com [74.125.82.69]) by kanga.kvack.org (Postfix) with ESMTP id CFA816B0005 for ; Mon, 30 Jul 2018 06:18:05 -0400 (EDT) Received: by mail-wm0-f69.google.com with SMTP id u21-v6so7641661wmc.8 for ; Mon, 30 Jul 2018 03:18:05 -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=JevUrdEJ1YaeX4DLkXWLNdQ3isPz82EDx2dyHk6x2JmXpwnC4Bem3d7NP0bbAfJP9M DVZy4Xipm2pPUmxNws7W28uoioY9jzos5OHcyS/08Gc3f923ncWd/eGXuYqYX1zuMGJV TV2Qkn7MLVHsBalLd/uQcqmfymSlMQ9Wq/0FNj+iC3breN0MPbZag3zhu6y0a9cRZiI3 wsgApCgkq90Ms1CFb7VJPk45PjR41qo5YhX49gR2ziXQBbndkHwhC7GDKfUeB/SCx0ee kUPSMlsddPdl7wfxeD3bXnjR/LXbyAd/JY0dH8XIkZQu4ZfY/tAqpddEJR5qmUDhgHHO m89Q== 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: AOUpUlFYRimhOqpGHgB4J/XuL5JK6o+L/T3wkMtCoCNelNmRah/M5iXu gSm9T7bVZzQiI/miqKXCi3hQkUqvp+R/jk5hgMdx9ny+8MpwqdLLrk+U6lNU0MmJxwgzjlq8sxg wwDNPDP/keeinREzxYIoCpu90xikIhPPJlQ/mWfOjDenenjXw3hxXa02o3jU3nIE3PCP/h42DAJ CEt5ea/cUidX4TNLg5F9/15gMT593C+f9kC558il4eJcOmNFbUTR7IOj1ObYMBxwcWwKRuoSvAn VTWgriOMYG+oOV4MSAa2LX6monr50MJkBl35rnsx2YX2h85/slMwQVhiNEshuKqT7N3bHlcSWdt Pi/nlP0rMy9FztzuUBqdvKYEqhgz7viQdsw5hCP6P1QFMLDjquMrmbmDOiEUsvNs/lrtVbLAqw= = X-Received: by 2002:a1c:8a0f:: with SMTP id m15-v6mr14825083wmd.33.1532945885365; Mon, 30 Jul 2018 03:18:05 -0700 (PDT) X-Received: by 2002:a1c:8a0f:: with SMTP id m15-v6mr14825032wmd.33.1532945884648; Mon, 30 Jul 2018 03:18:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532945884; cv=none; d=google.com; s=arc-20160816; b=CrwhwwMs6x6kGr3AKBzurgL70gBEBGL0DqwCkXroETdYQOFEkvxH0SNSAtleJu+IHP zLzyHHdaBvvBsCEagGEkd8BtsQ0jfSyrQRRBGP42nnF86FK7eHDrUlZm8ZZ6Fbu0idjF jBPXMj2vDUY7aErPlWDmtIiMHN8nJyLa70eaZjcVNz7m6b1XlDMe1W3T5f0+I12GQP/2 OeGzNZtSbHGCQzReVb2tLbnslhYFjr+7DetCfpHSbq+i3t2RW0oE7v0DPjGs+txX3YyC JpocRLdnzoIuJdZ96QaEGn6k7ivmSTJbhVLIV2sCnd1SX3wgZyPNvdEbiAgqEx+Kdy8U Fjog== 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=CwQWVZXqoeMj0CxYCoAu+qy0jSyoGAk4OWsKdI8c4CSollQzzJ82C3HIntC8i1cgB2 PEmsOCKmdvihNponSZkIfQO221OxpP9nOliT9kgvggG02/G4FrTnY0St6t0VjnadmRDh xKtHUp54RffATAti6EpUutayg1nDsu1V678bqi7Wxs9Ka8pw8T405mvB6f6BmQPPnh8c EAN7hvSNjR/IhLwGGpyaNRaR1OUpIrfzVGAW+7rSo5eBuf7blqVtI4EWcy2kqmGffvm+ H36gIq4OQcL+k3OgfyL5eDGJ4WTweIVM1O8oUAV4puobE7102jQu3xcFlDWYhBUCaKWh dWkQ== 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 l6-v6sor4479852wrp.27.2018.07.30.03.18.04 for (Google Transport Security); Mon, 30 Jul 2018 03:18:04 -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: AAOMgpcvakSxR0e1vEitRJ96u7k1p0z8ynlwV3GP9uDp1kpmxYr+UM+TlQIx/8AJgmHUOBKb/zLGdw== X-Received: by 2002:adf:f342:: with SMTP id e2-v6mr17160542wrp.161.1532945884403; Mon, 30 Jul 2018 03:18:04 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id a2-v6sm10747642wmb.6.2018.07.30.03.18.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jul 2018 03:18:03 -0700 (PDT) Received: from d104.suse.de (nat.nue.novell.com [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id B5CCB124446; Mon, 30 Jul 2018 12:18:02 +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, david@redhat.com, Oscar Salvador Subject: [PATCH v5 1/4] mm/page_alloc: Move ifdefery out of free_area_init_core Date: Mon, 30 Jul 2018 12:17:54 +0200 Message-Id: <20180730101757.28058-2-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180730101757.28058-1-osalvador@techadventures.net> References: <20180730101757.28058-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));