From patchwork Wed Jul 25 22:01:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10544859 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 E9F4D180E for ; Wed, 25 Jul 2018 22:01:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D79872A891 for ; Wed, 25 Jul 2018 22:01:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBFC32A8A1; Wed, 25 Jul 2018 22:01:57 +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 54C062A891 for ; Wed, 25 Jul 2018 22:01:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F08996B0005; Wed, 25 Jul 2018 18:01:54 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E88516B0006; Wed, 25 Jul 2018 18:01:54 -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 CB2676B000A; Wed, 25 Jul 2018 18:01:54 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f70.google.com (mail-wm0-f70.google.com [74.125.82.70]) by kanga.kvack.org (Postfix) with ESMTP id 63F956B0005 for ; Wed, 25 Jul 2018 18:01:54 -0400 (EDT) Received: by mail-wm0-f70.google.com with SMTP id q24-v6so3645683wmq.9 for ; Wed, 25 Jul 2018 15:01:54 -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=iGaQaQXmYAyM223AE8iic8TWSzrYbE3Dum/Z6gZtC6fERCVjGlooTH8I1qBsMiRStd UcKHnR3o89frFNzfWqIxQ9EyECi6glJkqUyVTJ4Zfw4G4BauOBYtvxjB4GXSKJM+zAZE qI5ayGQfInmj0Urbx9l+seDLUwPfV1NOZH4TM9w5CyrLqJsJ/0NzSdeV78E/Hv6SkHNF kJAZjacDPvq868EVmrtB7dK5NXTWFklAaneb1a4kWDC0QLoNji+zHQlU9slt4olUHJ5B QnNNW0BWMphHLKltC64pt8bhdf7weFbPh6y+38363E+wGpM07OR+XfJzV5Mvi+WKOX++ UIlA== 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: AOUpUlF/WYiKw2ucd2yk6l/sbvTJ9EVJ4RWg1Udp4C011nbkdRrcnoUL 7zXsytRFsCJJf0SEWr16HB7yTfXrmUS1HR7HscwgQQFgzmusLGVeBJduOJX0zahzTMA5BlL59tK Jhbl3udlVyl65Pg8Lr1FJvHlQ/gndDoi6P1di1WJHv92KIn3pyU68u+sszJVsf77EKfnZb2RZwN +5nlFbkSDjkrIoCODTGrSGHakLejqEvvCPRmJe+K48CdH6owBrds9jf9mDtMEPxEK1LGJRn881E M4z9sO6551Jrf2ErdMVQD6HH0zaL2xAqciGaGXXzUj3mUqVjDCUiORVcaH+xs6+1tbhAufWveXi YVvFckNNSHgtwuOT9fREPXHAZkwOIBfKdQURp84v/umkT0I6abUQPoqXL9BTZn0KCV73OlJaQA= = X-Received: by 2002:a1c:ea9b:: with SMTP id g27-v6mr5346342wmi.152.1532556113927; Wed, 25 Jul 2018 15:01:53 -0700 (PDT) X-Received: by 2002:a1c:ea9b:: with SMTP id g27-v6mr5346299wmi.152.1532556112529; Wed, 25 Jul 2018 15:01:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532556112; cv=none; d=google.com; s=arc-20160816; b=oHrdqrAMj1L/6exoHGXDwlh6x6VZrjlou1XcValQXHTuul6bKsanG2Gdfy9xhDMpCB mE43pRuDCcEc+Zb4aLERR+hw30blT/clUV7v5K1K2T9C7MClifOd5Hd7WLRL6OL4BJft syRGqcZLrsd2sbJyOiA6TlIHl+HNn+ty+MQvQ+zqN0Sk2aOgq7L23gXPQqTw4ClAfQcf 8+udYzRekl8bb+vmoaqvgoHALQv8mwXWnScaiEb45LbG5RQaRJQujwTOcw/CcMo+k4wf UhpVWpFkepZJCe6U7SfSjp3wNPRLwA4RyKIZHXtcLFDLVEerZgQP2bcAiWkcVUhZ61pM gsnw== 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=Vg19Nz80wtqkTom0pWf7oxsx9wR508W9vs4Ti6JqjelXOy7EO/W2RrC+6AS5DFYfjM DSMxgsMtDDVk7fZRFD/jCxhtKJ7CUhujYJF/V3UYs8Di3Ym9guhRQFEfHdB+TidUeClm hf2gfrPXgL24Cyo97VJTbqN86iJPDrSiExrOkUklMRBEVqPt6Rkvpe2DSkK8/aSaZHD4 7jAvvFFt9fB6NaJjBXSeJ7Hc2GrlXStypFdjoIdNVJzWTQ6FGU5gu/IFVKnJs8VPoZmA xTBaMT+sIJX1mddbZe1YceugI/7XfF4sLkdFlDmyyWOyZOs7dPa0nJ/2J9x5l18P+4+a WIPQ== 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 t2-v6sor6206364wra.73.2018.07.25.15.01.52 for (Google Transport Security); Wed, 25 Jul 2018 15:01:52 -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: AAOMgpftDpqxZHhmCrzBUf2teT6QSC+bN02o7cZGNJDJl8UR5DTe2sCvdgCrDXjNUB/kathH+yaUqg== 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> 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));