From patchwork Mon Jul 30 10:17:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10548859 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 B13CD14BC for ; Mon, 30 Jul 2018 10:18:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0E9329703 for ; Mon, 30 Jul 2018 10:18:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9578A29706; Mon, 30 Jul 2018 10:18:15 +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 3119529703 for ; Mon, 30 Jul 2018 10:18:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 478E56B0008; Mon, 30 Jul 2018 06:18:07 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 208D16B000D; Mon, 30 Jul 2018 06:18:07 -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 05CA26B000A; Mon, 30 Jul 2018 06:18:07 -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 9361F6B0006 for ; Mon, 30 Jul 2018 06:18:06 -0400 (EDT) Received: by mail-wm0-f69.google.com with SMTP id s25-v6so5264786wmh.1 for ; Mon, 30 Jul 2018 03:18:06 -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=bZTMNKXAP7obbL2MTTjNGFtawH7yK+qeUWDTDTp3PB/wKwJL/PEVjoCrrbIBavd1Ur n0LLI9pPnORV9jDmXyk1absZW76vEv5DOSZZq95acF0U9Db6b01dG49VnkNp0Ng19Nbr 9NibsMVRZO1W+nB1uVyZhU5dUqqFY08OBukrE2R0WcBjZtT8m1R/R2KDb6KYOzpFSOSB gEhblTlEXSy6NvYAfcxJ22nUz5d5DCuc8OrAWaR6m1j1j6BRHzDOcIoWWFby50CzpVe5 UwtJ7YT46CChj/N5UOVi7trYkV1FQzjYI7olhacV2qjUP728lej8uVQ8EHx5/iZpkJYd L7UQ== 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: AOUpUlGFB3AdbBGXBnmZt9D+tG73Q5nHvKbDR4hDI48cFmRDSZqVtYem AttXHeB5hjt20qe9wMajNwRaH/UXZlz4KhYAZ8J9K+pznd1cytLvnzZZqt6hrwoijfEDrthfhVz +U0/nmGerTyTtCD0T8YkRk+741KpRKP0Eruh0BjWvPbKAxkeaHaHjh0tPfsCjQwSZTlqzBGVOB3 fLdxKg9KlT/5gBkWy3150OM2eR7ZmoJE+KsMhFxtUF6yZXjOpHIJVOz57HPZLMm6ntKX5cTGNvd 9OsrEf6IbBEsn1nFXvExGnnUJBLKcBkCR4mv1ChxO/KPpoMQUiYA2JBZ0eXRZ7OaoeJrdAbA1YF UqkcQht+VORKwfmsyvr1x/3DdMDzEmLScxsa5sjVryD9JXhtxbM3I56VZ1Kh62OW97gNsf8TAw= = X-Received: by 2002:adf:96c3:: with SMTP id u61-v6mr17153590wrb.72.1532945886171; Mon, 30 Jul 2018 03:18:06 -0700 (PDT) X-Received: by 2002:adf:96c3:: with SMTP id u61-v6mr17153541wrb.72.1532945885545; Mon, 30 Jul 2018 03:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532945885; cv=none; d=google.com; s=arc-20160816; b=HEd9CH8B1ZiYfndYBD7nDCSEiw6IikRKp2xoGqpEp8sTaLJd56phffcKLdj3mdkrJ2 UDJdEoggGPP+gvDZDte3kVM0ZGrJSqT4th2dejn1G/GKLZmLn18+BFanbwlphxYC7gnm FTBnohX1vYKSjTwTEAfSJLD756T4ExJVk+p4kJE4q9AJUQro/fCAK5Y7GQsZSA2Lp1Rx Q/nhwHB3pAjgSsikoBI3GJU10HEBpJctOlrRth3+xAw3jfbo98b1RnnyZ+5RVVnbWr+u JF07ha7WP7XQEr4vJ+HMNo4T+c/BHSgKKA9cZ99O4IIshHoHh6uyZk/1JEGPOPVvbWvk L31Q== 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=IoRkJP5R31zq6EWBQgXp31ffGOnpFBNeLFgmmzU0riA0frQ6RDYvpt602lh4oeb1is 4/e1DqAnFYCJdt+heEIweH2+qpvD+7xsazR1zfSlASD8/rEPCJQji6bDQYJKyv7Um+4R 6um1ESHvATOJp4JHZ8h9JnHS1rQF+oZBo/4QXzDjwNJUlpVcF6jQf+DFfFXIDDZp+ZvO N8GOWfYpfm6Lw5rkImLwx0Cu/ZfcKzi6iIh5AtvZtAFZTKGgTOlIGKSjvZeO2802WSdD Oa/Z4DcEfE22w0Pw23mA78TZV1AOZAMtEi/E/+WJdc/mcWXA00akRx0mXFvFIn+8dDzH 3AaQ== 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 g2-v6sor4479957wru.26.2018.07.30.03.18.05 for (Google Transport Security); Mon, 30 Jul 2018 03:18:05 -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: AAOMgpfDkD8HTOD8T5QX45QcnuBXi6q6ZGk/UOmhrH3XoSmv8wsXmzIw2HQuh7a78XB+JJjI1PklUQ== 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> 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); }