Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp788361imm; Wed, 1 Aug 2018 05:26:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfkRCTigSBor09UB43sgGxDQlk45pgdHJ+Dp/zQ3Zj7iD0N8bUKo2yITFZ4dEioQxQ9yddW X-Received: by 2002:a62:67c2:: with SMTP id t63-v6mr26817109pfj.204.1533126378909; Wed, 01 Aug 2018 05:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533126378; cv=none; d=google.com; s=arc-20160816; b=ykXGuQ3APnirfwt0tsYK6YSLKlE0jX5jl/zJjzt22QD+iCb8pfeZ+OvZeSUJxNxX0i 5tbDj7bAtLZni3tzOlQ/vxsxEuAsiaHLjn174moABopP5H6xJ1gOTu0WybYkzgfKvi7H rMOPoPiC1pAxVFVi6HUS37Vyls3uImBL6pC9wCHegeRNIyTUuX9FmDzktkwUtXauGaJt ma1y/R8bowRFx+iplg3FicIKYKnJvS2wSLWSSpPV0rQBXszO0luIhqseNl3LY1NvnUg+ nW9o1HCciLNtea4XsYmrK6y9mpizBdgzcP0SGLqaKu+1wSGa82tmjBTxNP1VDXU26DPg uxUQ== 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=D64Mkwf8KbDFNcAAymsFtzvDXY06XAPrzkCh16O3amM=; b=lKeHAFp9rbNEdAP2QfPuQ1SNpskLbWhj0rnKCWlyIIlKBG/oZRSBGCVITr+1EIKcf3 0eyB8NKG4nIIavsVAcvGeamPgabgZCEGxExvFKQS3PscLMRxihAltvS5FbvuZ8ouwScZ hzBW+qI+d2WhA4qG9yztuSFr1gqiEhXMW+KJm49b4m5Xp3S5zcpWIKf62AbNnRDkKT78 etPKCT4H6NZbGqJBxq500pquwJ7izT1PqBrwZxYXnoa3sLShHDQdD+UfmAEmM2Vmiktd Deh09v2lvhDBcA1uuvP95EupXRsaZkuaxK3mhy/UtL+z0Q4BX7ZaU3doQJ/6nQjoQKrG aG7Q== 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 b22-v6si5466353pls.127.2018.08.01.05.26.04; Wed, 01 Aug 2018 05:26:18 -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 S2389121AbeHAOJa (ORCPT + 99 others); Wed, 1 Aug 2018 10:09:30 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41014 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388530AbeHAOJ3 (ORCPT ); Wed, 1 Aug 2018 10:09:29 -0400 Received: by mail-wr1-f65.google.com with SMTP id j5-v6so19933261wrr.8 for ; Wed, 01 Aug 2018 05:23:57 -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=D64Mkwf8KbDFNcAAymsFtzvDXY06XAPrzkCh16O3amM=; b=ogxuivwM0UwzlJum9duNoU5e6OxW8b+z0t+wYn6MXtwz5e8+bsr3I0W1zXuFkR6a6j Tvi/dbRnKG9uJru7U29pCXg2Upr9EVYiCOq2aIf1eb+V+X34HxYw6Gq2fjB7S3berA0k M+18K/1k/B4yBQACKmfQFk266CXx3+FjlUY00fUADwxBrrSGssjrytNXK2GeIjDU/zkG FKEjh5mFQ7qkvHBnr1H76SCHFLBmErlnN8U3sY6ryLwqHgs2xrkDV47Us9wdkqt2y6L4 ej4fNzWP+YNxbeLqfCT/vwbGYI57iJxc5PUfim5Og6WOhIr947DCAx1+KnNg2Ik2PJwg R9tw== X-Gm-Message-State: AOUpUlGElOv1oUACSnYJkLkYfhv/kckMqqqp4w9f1WYOjUfd/yARZT1A P8wepnS/qsgtBfBdIVvTrPg= X-Received: by 2002:adf:a541:: with SMTP id j1-v6mr25580112wrb.155.1533126236593; Wed, 01 Aug 2018 05:23:56 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id d42-v6sm2445508wma.0.2018.08.01.05.23.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Aug 2018 05:23:56 -0700 (PDT) Received: from d104.suse.de (nat.nue.novell.com [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id B222712453F; Wed, 1 Aug 2018 14:23:54 +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 v6 1/5] mm/page_alloc: Move ifdefery out of free_area_init_core Date: Wed, 1 Aug 2018 14:23:44 +0200 Message-Id: <20180801122348.21588-2-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180801122348.21588-1-osalvador@techadventures.net> References: <20180801122348.21588-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 02e4b84038f8..f5e36713c5d4 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6196,6 +6196,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 @@ -6210,21 +6241,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