Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3775621imm; Mon, 30 Jul 2018 03:19:48 -0700 (PDT) X-Google-Smtp-Source: AAOMgpebIkTvgD7p6JphJ7yBZMgGtWyg/HNCCi8H3uXCFOcct4r1gLrFO4yQL7Ti35JsD6M5uima X-Received: by 2002:a62:c410:: with SMTP id y16-v6mr17262591pff.161.1532945988666; Mon, 30 Jul 2018 03:19:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532945988; cv=none; d=google.com; s=arc-20160816; b=I14mW1dfNNFqhShsLfwbxGjWYQEe6Lyw35rVJ1fjxb15a+PoedPwDapkbUsAndm8nC 1Q/4nR5MogAxtOXv16vGsKP48H8vdnwLpTd8cIY1Ez783ayuYNsNLQ4xHa265M35aGoS qQHyQV/1rSQjgRltMHReULEoik0GmeLnGab3IYPFaNpdV3fNQB8APjCTKa8CE5Ya6fo3 78u6bWG2tIq23moRLt/LIAzgo+RToE+kcl50oL3St1Ke/85vePn1nwINIvHtihdGhkin jskfgekav1LWA3EklKrTypKpq0bJnrPywWEsyZsdk8U43h60H3qwTUEKe1S6nlrs9X9M Q1CA== 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=bLjX86dg8uQeCW6TtBr2m2PymECIejY8mSgyHYdYlu0=; b=guG747r3qMIA7HnplhbePUXUriOM0qcOC5cd9Wz9Dvms9iNuhxaYt/AgS0stzzdNnP oC2/aic396Nb1nETI7Dp2+Ww5E9PVLrBVzm1N4B7o/J+NCwl5sxkBhikN9+RHkoc3fni JizGrYkLWhKGCChd5VN8v80yFNnx8CjnRwKM5Ta4eZiRM51E4AoZtYgLXmKJQmOqwBIp xAeb0eDH3DDN5xoVIVpHJkeo7FNZzY9vcKsfBfSPMz6BpTBIRI+NrEnEmYeP/uh6v9Ji yjObBk0Wpo2r/OmtKRVOslpgVVXK6O7fqR3KsHFHMYQ9h+hmA/v3odLAIg1h5HvspW1C rMvA== 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 m1-v6si10176808pge.531.2018.07.30.03.19.34; Mon, 30 Jul 2018 03:19:48 -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 S1729057AbeG3Lwl (ORCPT + 99 others); Mon, 30 Jul 2018 07:52:41 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36657 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726597AbeG3LwX (ORCPT ); Mon, 30 Jul 2018 07:52:23 -0400 Received: by mail-wr1-f68.google.com with SMTP id h9-v6so12255293wro.3 for ; Mon, 30 Jul 2018 03:18:05 -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=bLjX86dg8uQeCW6TtBr2m2PymECIejY8mSgyHYdYlu0=; b=hp/sYbJaXAsSsCLlC5R2kXOYytflVr+/U5EFlhKWB6QrBrAJc8d/a6Jbhcz90RaMsU V+49hoUGHzEjR2vu/D/sCTHQEj2Rzw9rNYlJS4WAvlNBcdKlw5wrEtmbUTRkHAA7XI7T zmVxkw8jWZwx4XrhPjMBLe+Ew2NFAXNX35ltiDLB1E9rtZiImXda0Vz4gBxo+0AFHg5o jSDRwIizN4i6+UE3nBk1nkTFRCkMZfTlwG6nNQsLQXcGaMbhA09Rbuoa+JPJZatVdhxe 7m4mbZK4C59XG4ZSdgi5ITRleVVyGYBymR056hIHq+Qw9f8E1c1i+ZCZJEqKsFmgLKT7 ZXKw== X-Gm-Message-State: AOUpUlHg+u/+0sMED5N0X/7dKWzuX+XE6k8IafkaVZ4v7uM5subkWRvX MOCOVK0ZDgErUhg9yu8XAWo= X-Received: by 2002:adf:9c12:: with SMTP id f18-v6mr17387965wrc.93.1532945885293; Mon, 30 Jul 2018 03:18:05 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id 188-v6sm16724942wmv.11.2018.07.30.03.18.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jul 2018 03:18:03 -0700 (PDT) Received: from d104.suse.de (nat.nue.novell.com [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id 3D248124448; Mon, 30 Jul 2018 12:18:03 +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 v5 3/4] mm/page_alloc: Inline function to handle CONFIG_DEFERRED_STRUCT_PAGE_INIT Date: Mon, 30 Jul 2018 12:17:56 +0200 Message-Id: <20180730101757.28058-4-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180730101757.28058-1-osalvador@techadventures.net> References: <20180730101757.28058-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 Let us move the code between CONFIG_DEFERRED_STRUCT_PAGE_INIT to an inline function. Not having an ifdef in the function makes the code more readable. Signed-off-by: Oscar Salvador Acked-by: Michal Hocko Reviewed-by: Pavel Tatashin --- mm/page_alloc.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 10b754fba5fa..4e84a17a5030 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6376,6 +6376,21 @@ static void __ref alloc_node_mem_map(struct pglist_data *pgdat) static void __ref alloc_node_mem_map(struct pglist_data *pgdat) { } #endif /* CONFIG_FLAT_NODE_MEM_MAP */ +#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT +static inline void pgdat_set_deferred_range(pg_data_t *pgdat) +{ + /* + * We start only with one section of pages, more pages are added as + * needed until the rest of deferred pages are initialized. + */ + pgdat->static_init_pgcnt = min_t(unsigned long, PAGES_PER_SECTION, + pgdat->node_spanned_pages); + pgdat->first_deferred_pfn = ULONG_MAX; +} +#else +static inline void pgdat_set_deferred_range(pg_data_t *pgdat) {} +#endif + void __paginginit free_area_init_node(int nid, unsigned long *zones_size, unsigned long node_start_pfn, unsigned long *zholes_size) { @@ -6401,16 +6416,8 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size, zones_size, zholes_size); alloc_node_mem_map(pgdat); + pgdat_set_deferred_range(pgdat); -#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT - /* - * We start only with one section of pages, more pages are added as - * needed until the rest of deferred pages are initialized. - */ - pgdat->static_init_pgcnt = min_t(unsigned long, PAGES_PER_SECTION, - pgdat->node_spanned_pages); - pgdat->first_deferred_pfn = ULONG_MAX; -#endif free_area_init_core(pgdat); } -- 2.13.6