From patchwork Wed Jul 18 12:47:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10532421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C61BE6053F for ; Wed, 18 Jul 2018 12:47:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8D982915C for ; Wed, 18 Jul 2018 12:47:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD29429162; Wed, 18 Jul 2018 12:47:42 +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 4ADF42915C for ; Wed, 18 Jul 2018 12:47:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 124716B000C; Wed, 18 Jul 2018 08:47:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 05B676B000D; Wed, 18 Jul 2018 08:47:40 -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 E8AC16B000E; Wed, 18 Jul 2018 08:47:39 -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 8F5526B000C for ; Wed, 18 Jul 2018 08:47:39 -0400 (EDT) Received: by mail-wm0-f69.google.com with SMTP id l4-v6so1006373wmc.7 for ; Wed, 18 Jul 2018 05:47:39 -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=VYAg0Cr8uIBSNKsKO/TPs6ZQoAohB/dqzV9rC516WJY=; b=h/1u6QuKs8QJGxx5BVgVcgcLTWUIUnEiGUX+r4o1aPdrK8Z/gwuNSFHfN7DdOrNKEN iCP/S592CFJbB43CuIREGgv8KMrXaKXsPJ26b+szXB8VvcXtdckVX+MqI9x92YR03Y7Z AWZAONVU6UhYeazQrlJlbL3uc6V7J567chR9g0dfEAvt3ilfuoBVK9x2FI1bjM0FmdqV YFTIgz830tBIgTseMvluWFWsY6I0z8dIrYv/RS05QSZwwBuG7WFv5ovuXHSaVeLFsJ2j S7nI6KKo4SU1dXTlYPxOGEq2ROAcqlgE6UeSj4yZJu4cM+aB88kQ2Kk1TumRw4BMF3LD YPVQ== 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: AOUpUlHbir0Mww36STMwFQwOjlZVDq9X9rQR+UE6nfuyn/YMAr/l7GW9 Y1/7oV8ETt4uVPT2Ul5k4RXNq+a9kJJTiySa/E5Mh4h6hOpBL22pOL5fqHxRT6eHRowq3orfADB 80wg8V8F93YrvkiAN1MYQPSHe5VRVVDr8gVPdi+jMKWL04agcu+Mp2nR0HjlP1f686ebEgl3gDr 6OYgbKnFSqij9ni1cg1iYiHdCk3pEF32f1cr2vmylhYn9aQIOS++BypR6D8cyweyYaIXhht3NQU vnb+UOM+Fu5t7Q4aRSuYzPByueCoCHyY4zw9f7wWlghG9uxC0HqgLvvhnZ8Osq4a+6yySGwsd+z yPohvHA9rjaFQHp7DDh9IkcmHzFjncICnWJOtv+zQdD4QPflwgfCZQGmqh+ZNOR5EGUZcrU6CA= = X-Received: by 2002:adf:da4e:: with SMTP id r14-v6mr4297189wrl.154.1531918059127; Wed, 18 Jul 2018 05:47:39 -0700 (PDT) X-Received: by 2002:adf:da4e:: with SMTP id r14-v6mr4297167wrl.154.1531918058529; Wed, 18 Jul 2018 05:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531918058; cv=none; d=google.com; s=arc-20160816; b=W++lR9tYcCjQkdoTjpRDp0Kn8sW8OeAcT0y9UGtG05bzGLQTCk6Sr+wWh9jDdQa5Hz hgx52c8zW2FhMU9Kjkb8QK2Bm5l+1pf0piO3BFEQeZmidcdVIj5dKlYGqIDXTDZ+HOd+ g0M5sZrsYVNRxnn8GqE7gC6OqZSnz2PfXJdrp6cleYhXmriiMEM71zsTGJPxS/dtRUlS Yu80kzIaN+9oLEw7u78oVo3xvnHZjByHd4rTtbm3mDE0hsFaO0V6VnIkSQC+rE15XtEu fRf5hTIaysz0/bEE+b0z61d4DV9j93l3mwNnOOrZxHrWf0z7IEp+yl0fRhLwZKvFI7Rx QiQg== 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=VYAg0Cr8uIBSNKsKO/TPs6ZQoAohB/dqzV9rC516WJY=; b=B8KFUFdEIzwML5l0ftDnmSZgeyks519nZj5idlLxTpkNg/ifRkV02OxJC15RPXNCG/ OsxUX6pfF4D+drJrbr2L7WAwmyZJ6uP3DaTJnrq0gkhTylBxP81oviSklS2NrCb1Ylsg SNL5Nah8w63QMM7DbeNT1XXo60hlHqOaEwrbrUtwj84HPG53ngpar3tindfaHNApiYL9 tk8r5MgOTBGKjgfL/FybGs+Yp7xgNt+ZQuMSXM5QmKQAdfsqpqivNLXhbHqFOSToHkdV 8ZNaEXT/X8E2ZT0YhJ8GDzyRGBKhijB1LgSFiV/k61/ljMcI4Uwe47oN6byqKsfwrLWo 0miQ== 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 o17-v6sor1639019wrj.44.2018.07.18.05.47.38 for (Google Transport Security); Wed, 18 Jul 2018 05:47:38 -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: AAOMgpcMVCngsqXUh5CuTtsu0ynwMg/o7AU0YCKxdCRtzFrSUkbFBHQ6ClKHQiI+1Z0vezK62yALBw== X-Received: by 2002:adf:ffc7:: with SMTP id x7-v6mr4529521wrs.137.1531918058276; Wed, 18 Jul 2018 05:47:38 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id c5-v6sm4598730wrh.36.2018.07.18.05.47.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 05:47:37 -0700 (PDT) Received: from d104.suse.de (nat.nue.novell.com [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id 3643D1240C5; Wed, 18 Jul 2018 14:47:36 +0200 (CEST) From: osalvador@techadventures.net To: akpm@linux-foundation.org Cc: pasha.tatashin@oracle.com, mhocko@suse.com, vbabka@suse.cz, iamjoonsoo.kim@lge.com, aaron.lu@intel.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Oscar Salvador Subject: [PATCH 1/3] mm/page_alloc: Move ifdefery out of free_area_init_core Date: Wed, 18 Jul 2018 14:47:20 +0200 Message-Id: <20180718124722.9872-2-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180718124722.9872-1-osalvador@techadventures.net> References: <20180718124722.9872-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 --- 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));