Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1277018imm; Wed, 25 Jul 2018 15:04:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfCWVcypsZYdU3QFMuIS4HTrX4tgVtD46YarWCMd8SkFNLdQ3F1oV+Gb6f/6Ldv+M6R/d9g X-Received: by 2002:a17:902:4503:: with SMTP id m3-v6mr22693153pld.168.1532556275114; Wed, 25 Jul 2018 15:04:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532556275; cv=none; d=google.com; s=arc-20160816; b=Pfd0/EPiG1EAQM/6Qm386+ezuCTjxJ/iKu5fighVTwtCewvRsFT8gmsgZoj2vrbtJ6 quWlPtTiSio4oYZUCD32aFyBGg4i63c472Sj2qLze1NyKAIGFfFyiN6Ezaa4xpOZWkek EPxva7VgYEvwuSy/M3vHrXIVXXIQJvL00ZBCDZu8cmbZJbkYGO9KdaDhKc/gmKeKtR/p /uuaFlIELT3gqT/6pTwT6CFMxegNnqkD/6lGdsIwIYKA5wHGkGlACLFsb9r6pAvTNtXL PiDno48TttNNCmr3X5gp0It0bBsI6z7gmy5swFpFGF7UgRAfby3zQwX+o/8SN702NQTW PYDA== 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=TXHJQL1Fiw4W+d251LqNDmUW97MBwnWKGEq2xdm4uJd2QmjVomyCyUZgQET51piNIL mg9xrspzIVHdfIjohcZTNEFTJgNvNwGEzKaTHAifnrUQDkkYou+81t41Uiu9+Qa5c4aw pCAn8ZPFPgRYdUuirirbiv/Y8ZRKJfOZj14FZqGwO+WCXhIGy60NjNDH/roxShd46ih5 R/g3rx5dLECX3phIPrklxNB1yWG2pbZ7D0QRkZjKZPmPwS9S2xjH+bx1YOZ9NScZSYrO qkFLFZ9xW/SUNNlkF4Zw0LvNbZdUoFcIaC1g4CjPZwkv9PZWZss8Pb5ixsptMPkv8rMj lyQA== 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 t6-v6si7139062plq.268.2018.07.25.15.04.20; Wed, 25 Jul 2018 15:04:35 -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 S1731480AbeGYXPd (ORCPT + 99 others); Wed, 25 Jul 2018 19:15:33 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:42246 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731409AbeGYXPd (ORCPT ); Wed, 25 Jul 2018 19:15:33 -0400 Received: by mail-wr1-f66.google.com with SMTP id e7-v6so8759386wrs.9 for ; Wed, 25 Jul 2018 15:01:52 -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=hnXotbKxNURdYCGO/b6ld/DjMIVTmk6Tqz7kJJBJu6mgHkHqsIiFSGQRK0TkNBZ8Kn ECXwbwpcIp6R2IqEhDkG0hU3uRhyXE7n1bdlabtZXBQlnV2/onZOMyF84gVW5HCPtDTN VatN+9Cr+mru6bxGV5/Q1GheFLzTtPrI2lpVlKh8VcWmGGssDMQjXdVsjacnqfKQMMvL +HQYiRRZb6IOeOImh0i/pV0BRjvmT/i4ojwIC45r48LH4v1tIXkVGAJfZ0uSS8Z6hOvk unLiEroNkzEamFlfCPBjs/UOBUly4LgF7Cv8Wy0inkS3VeDOett/zD+/2Mve29pVZ7oJ O3Ng== X-Gm-Message-State: AOUpUlHbvTAkDYA40HMAhcSjVgFaMDLR6FM9tLH3fXa0vJnayXD1jbsZ EDTjiRIXSiTdbWMishA9akw= X-Received: by 2002:a5d:4542:: with SMTP id p2-v6mr15773813wrr.191.1532556112278; Wed, 25 Jul 2018 15:01:52 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id b11-v6sm9642302wma.34.2018.07.25.15.01.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 15:01:51 -0700 (PDT) Received: from d104.suse.de (charybdis-ext.suse.de [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id 4DC21124364; Thu, 26 Jul 2018 00:01:50 +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 v3 1/5] mm/page_alloc: Move ifdefery out of free_area_init_core Date: Thu, 26 Jul 2018 00:01:40 +0200 Message-Id: <20180725220144.11531-2-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180725220144.11531-1-osalvador@techadventures.net> References: <20180725220144.11531-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