From patchwork Fri Jul 27 14:03:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10547213 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 9570814E0 for ; Fri, 27 Jul 2018 14:03:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8452F28795 for ; Fri, 27 Jul 2018 14:03:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78BF52BC3B; Fri, 27 Jul 2018 14:03: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 073A82BC39 for ; Fri, 27 Jul 2018 14:03:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD6196B000D; Fri, 27 Jul 2018 10:03:36 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A5F496B0010; Fri, 27 Jul 2018 10:03:36 -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 8B6AF6B0266; Fri, 27 Jul 2018 10:03:36 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by kanga.kvack.org (Postfix) with ESMTP id 128CF6B000D for ; Fri, 27 Jul 2018 10:03:36 -0400 (EDT) Received: by mail-wr1-f72.google.com with SMTP id s15-v6so3186416wrn.16 for ; Fri, 27 Jul 2018 07:03:36 -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=bLjX86dg8uQeCW6TtBr2m2PymECIejY8mSgyHYdYlu0=; b=sJaBK64BfPpSr1Yp85VZSd96S25x9wJ9VtefF+3JA5p8YQxT/lhIQN+nj5xRJDFbaZ 7rpxuur6AkL0R+ASx5Lh1O/3b5z3f67MhXVN43UjnEBjJhnfMJ1X6u2RJvAB/3FBqIw6 yQhDOGeSzrg+RUQ8578mtzAdJ+pXh99t3maX4tEQ7IdR2gmbZcQ9mY9/xQr6vt1GM738 WS/52g948902gYx1HjRZ6nb/jagNhN3hJM9Pq5hwpLJyS9jF5dzIHBzzJ/f1r4tCxO7y QNQma7v43hvgfpLuyStlAW9wANLLPsV9pGkR7Lv7lvj+UXcWWQUA9JEyaaxCg2DqQdaR V+bA== 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: AOUpUlFQvvlZI8lPP4ZWuA7nm3gRY9gUg4umw9ZfIuQvqEuGpke3q0/T +6lDqcsSgtstWdGh1+uGyUgwbwTW2g0pjI2XiyLOVlw1bLf4oSrqW8qLnwTWvZwyishbT5YgvQz Q9RGNeJd93kuNMGZ7xlEoaUE+QsnDPFemyLmdlrpK9JWjVOsDg+pf1vb/SaqYMEvTTGaRSlq5TC 0PyLuXw81wIoZzWpPPCLnv9hVkyfqvqIraIsQqM/6FINl90ddIGFs9c4mE9c2O4qL5cvtsFdLZ9 sbYVNOI/ys87+Rbn5KXseVtzEldjkABj+fvfyuH/MTu/80UwZAIdSOqao21uNNdzJoZDuoQEjhO CALGaUGUm7VmozB553Knx+3eLvbW1FZN1T/Y7mNFnROsPOnhLIQ97TXi51jpxcJOeXAjKJSfAg= = X-Received: by 2002:a1c:dc41:: with SMTP id t62-v6mr4467717wmg.42.1532700215635; Fri, 27 Jul 2018 07:03:35 -0700 (PDT) X-Received: by 2002:a1c:dc41:: with SMTP id t62-v6mr4467679wmg.42.1532700214886; Fri, 27 Jul 2018 07:03:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532700214; cv=none; d=google.com; s=arc-20160816; b=JyRbmjlXkGpZtB3CUtkOemNcVe9H36UhOUOatfnOQLq85epMJFuW/ISakLTMY2jvN+ amycYzFDqMKOIl+kr+muVB+ZQ9cwhi4aXXIwdKLrigg5XlNuGiwdMRTknYTY1+Tovlk8 H2URu+ujXnaNqGcgyZU5e9SHJi0zF1z4y8sNKXp1679JpjtAeyJTHxEj2yniulUY3CxB emYiLF2yoiEExvI8Jhkc4NTvG/jICVOsqP0dkMr/xh3cp1dVib3QcLjHyr5mMdmg9wAo PIwhqezOxtQfcZlAEawSIYM+USWdFciSlc0ZWRN3XuMsHnOu1h+Lhe8DZ9fLSrf6qnfn rNBQ== 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=bLjX86dg8uQeCW6TtBr2m2PymECIejY8mSgyHYdYlu0=; b=cog61DgUF19ezk434CbGmX8pEcfwNsLy02YiQDy1ZlI1oTrdU5zUje3618RLQr2CG8 k7cw+B/n6dDfok+ra1n417RyLFlXzj+qGMKZH0ZPi4tyFvknm7yVKnHoDWnGPLB/dcyt HcSyY34GETTnl1SFEoKFOt3lMkfFdFGGhJzb87Zk7mpJrrCcY0lyd9eCdn8GfqCVh6uP MIKnze9Qak1aFTKMFFGzoQIQU4ypiLBnSQr5PPnHcJsQrGu9YcGrS4isI5jDJyFNIfcL 5L5mDZBzZQbzGnEs/Ezq291Tu0vhjjYdVBr7o3maSAdoqT8bM7PKn8eGVpfl2sP89vOl sLNg== 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 v1-v6sor1011379wmc.53.2018.07.27.07.03.34 for (Google Transport Security); Fri, 27 Jul 2018 07:03:34 -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: AAOMgpcBIboTEUwcb6wP210AtcdEurM/V+DENPIG4N3H4v88x1FelOMS2isMJCNkG6IK4LG0fEgTkg== X-Received: by 2002:a1c:7d58:: with SMTP id y85-v6mr4283926wmc.91.1532700214603; Fri, 27 Jul 2018 07:03:34 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id d14-v6sm5587085wrr.12.2018.07.27.07.03.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jul 2018 07:03:33 -0700 (PDT) Received: from d104.suse.de (nat.nue.novell.com [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id E4F06124407; Fri, 27 Jul 2018 16:03:31 +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 v4 3/4] mm/page_alloc: Inline function to handle CONFIG_DEFERRED_STRUCT_PAGE_INIT Date: Fri, 27 Jul 2018 16:03:24 +0200 Message-Id: <20180727140325.11881-4-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180727140325.11881-1-osalvador@techadventures.net> References: <20180727140325.11881-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 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); }