Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1697216imm; Thu, 19 Jul 2018 06:29:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdoxox8nUz+EXvUOHjCzi+6aBCcb17r9H6f4WiC5G0L+Fjy52vjh/GurrQ3XyEToGVw+a7S X-Received: by 2002:a62:3e1a:: with SMTP id l26-v6mr9587556pfa.214.1532006962832; Thu, 19 Jul 2018 06:29:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532006962; cv=none; d=google.com; s=arc-20160816; b=etam5quwX5P+m4s6H7iuU2QchUlSQW1xIAGCyVdaL/ErKeIYIcS8HGL1vKAOjQ1SKw y56WDj/Z/gIxbrmfmCuB1rG01ZeiAclc60m0kvhNgtXCnpWOHZultj9+KuowO8HNgGa7 hYoMCbsJDGWbpOIK3IKzo06iW3o+PEZ9Nz66ZyM5lXYa6bKtSxwLBhTVZkGyEzct3kkj zEeKf+ghzgfAytReckvoy4PFBWCIiHqtKHyFVRdgw8swrOvgKEE8qwAM0if9Ta5t9Wu2 +txaCGa5y0P/22f1zZeVklK08kOB0Gy08DSCJH4cznb3xVPX9pPF9jB8TNkzVriI5nOW dWRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=09jE8HQnR78gKgCVm3YT0g0xgTev+DzLs5mljNQWB3Y=; b=vZN2MCeupc03uFpVL6z1dYMRGogZ3qwxXYPSYlNVvYHX7fsaUpzCZ+n0xr1OAA7gBd p88iXS+1d1pbjEIi6NMlf5Je5ORSg4QxCB/gnQr7xkt2kLcn95xPv6bj2B9oZGJ+MDjv pfc8UOMieie8LzC+j3lvf9YWga34yYYNiIhx9FFcpqDATcw5v2VETptzrZGRBZhdT/Q4 sHsyIHn49MSCkvJ+4mrtjf/7WcZ2n5O/w8IAw29evfh5qAxuTuExb9fgt24hzOBc+/jl 6WaaBtbGgUDI1W0vSY+FzviZxo8uCW1TOn3sWGgSkTGnQByNZWlnk8vLJuaIXM7dKCF/ aB5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o8-v6si6152481pgo.175.2018.07.19.06.29.08; Thu, 19 Jul 2018 06:29:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731826AbeGSOK6 (ORCPT + 99 others); Thu, 19 Jul 2018 10:10:58 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36128 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731696AbeGSOK6 (ORCPT ); Thu, 19 Jul 2018 10:10:58 -0400 Received: by mail-wm0-f67.google.com with SMTP id s14-v6so6453891wmc.1 for ; Thu, 19 Jul 2018 06:27:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=09jE8HQnR78gKgCVm3YT0g0xgTev+DzLs5mljNQWB3Y=; b=i4DHtaWigws//aRgJrsKn/98Uss0LoLxTrvVZOWohlCecBBkOIIdVxfLbHnnryVWBG Ipbmatfzh0H9PIRwakt1zjddGa6ZfMA7kAPsyUiuESYvmxNlT/YxXeUJF4Zk7WuCS46p +xbPWj4yI/2YuC2jk+SFNSXbaisNJtcRwRIhbvzFNfwJvgUIuby3BFr56q/OFTVmaWLW Zp3uS8w2kE3fRf1kVG6Ob5OEdI/DHUV6st8MgMnCT2Ip5ymXZ0CTeYlHdEEf32GrsqwO vA0cnIJl3XZNz/VCqn7bZ+Wd/6aiuOGYfuh40DKwJsD/m3Yg1P5GE8uKVCzt0jA3ygE8 AHXg== X-Gm-Message-State: AOUpUlEkTBmCRgaJDApfVOZE57r1J7lv+YLrBYj1Oh/ijwE+bXHK8/GW V6r9aXtUhj6n5QcxYNH8qto= X-Received: by 2002:a1c:2142:: with SMTP id h63-v6mr4418221wmh.51.1532006866682; Thu, 19 Jul 2018 06:27:46 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id g10-v6sm8210140wru.43.2018.07.19.06.27.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 06:27:45 -0700 (PDT) Received: from d104.suse.de (charybdis-ext.suse.de [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id B28AA124172; Thu, 19 Jul 2018 15:27:44 +0200 (CEST) From: osalvador@techadventures.net To: akpm@linux-foundation.org Cc: pasha.tatashin@oracle.com, mhocko@suse.com, vbabka@suse.cz, aaron.lu@intel.com, iamjoonsoo.kim@lge.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Oscar Salvador Subject: [PATCH v2 1/5] mm/page_alloc: Move ifdefery out of free_area_init_core Date: Thu, 19 Jul 2018 15:27:36 +0200 Message-Id: <20180719132740.32743-2-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180719132740.32743-1-osalvador@techadventures.net> References: <20180719132740.32743-1-osalvador@techadventures.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)); -- 2.13.6