From patchwork Wed Jul 25 22:01:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10544863 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 A5BDE1805 for ; Wed, 25 Jul 2018 22:02:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92FB12A88B for ; Wed, 25 Jul 2018 22:02:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8746E2A8A0; Wed, 25 Jul 2018 22:02:02 +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 272C32A88B for ; Wed, 25 Jul 2018 22:02:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5603C6B0007; Wed, 25 Jul 2018 18:01:55 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 52E056B0008; Wed, 25 Jul 2018 18:01:55 -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 054226B000A; Wed, 25 Jul 2018 18:01:55 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f72.google.com (mail-wm0-f72.google.com [74.125.82.72]) by kanga.kvack.org (Postfix) with ESMTP id 980066B0007 for ; Wed, 25 Jul 2018 18:01:54 -0400 (EDT) Received: by mail-wm0-f72.google.com with SMTP id u21-v6so2093139wmc.8 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=Ad4OTLIPpMcbeOgRn7cNcAJiN8JJ4IImE90/3zrSenU=; b=mjZHiUdzWVkxMMUCnAcLg0mqQQulV23qOqXGKA/ISdrK9GdaZBgY7zHMgDONnpNZQZ TR6OLVlwLZ08pjQapeDJ8xcWAyezZhe5F56bCv8AjuZSF+oP5ehOLjqTYwnRnUkaobSK O8FNQEUiDTGN0dOZwbP5luQG3EDD5qKfnDGQdafiJ21xqRW/4RHoV6F/5YZTUEsiHCGK 5V/FqyKOSff99bQFoVz0sutKYEvtdvvXVgi2AD06cigkrNJ5dGYJH9hOCPIJdEcZ2pi7 qQx2lJ8pP9UXrKyJtgk9P1lFMlS48qGPh364trZNHqBJuX1v87v2sutottVCv2NEKNri uRRQ== 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: AOUpUlEZQi/E1QMX7liOZuJfu+SqKekcfkiiVqttU96itlowqEDM0yo0 9rGXi0UD4Ihw54PNN8PDbd1UNAnYb/IiiksymaWybb0BKe9ERRnX7z8XVJCOtLIJO6r6p+j0c4l Kehz12HFT4a9ttasgKJ/zusO/eczo6mtcoUOzuRhYEAhuivSUubT2DgB+fheyWzXiFz5MiAu2Vn kJ0JFnFevG4HZaFeawHcCQDyHrL44gE0MlUKRYQvRKrsT49UrZMB15SWdy/8FAdFiDKdSjYDBHg 1Man+W5wLY1eVOcO9xCWh456XZALQcqk6/ISmFbyZY3Okkl1h44kycWyIdPFBxiBqOcie1v9l+T XpcKH8iN9lRZfnsg4pRopIxsRzfMJs4Vh5uT/pkbhHYhgBlQpvqEYi4pedL7CSzX45o1K0yYhw= = X-Received: by 2002:a1c:90cf:: with SMTP id s198-v6mr5800498wmd.5.1532556114126; Wed, 25 Jul 2018 15:01:54 -0700 (PDT) X-Received: by 2002:a1c:90cf:: with SMTP id s198-v6mr5800473wmd.5.1532556113361; Wed, 25 Jul 2018 15:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532556113; cv=none; d=google.com; s=arc-20160816; b=HbW3uH+nyrmNOoBNoOhMdcL73U6BZJDWdZELYaQ/7F4I7SYrI+gfBYogYhWVlpBvfo QvUiiQdUrXwm343wqGsfadDA28YcFDyKOADvhmJXTR28uewEm6aXgj56rcatm922X2a7 Mux8pAlazxAvIb2wO9u3cBb17ikugKWxcY+62uPgP+rMM1EdHLg1CpgWOsjIqqWM4tVF IiXE9OwHDGnFP14mFHcLApbTUrlhJfMJ5F/lEHOGH+tPxCKFK52fF8Oeawve3jC7hPqg hqnBy90inVrGhH1F1C3vTpcFAkhtZoeGrv1ahX7q85YEHcu+D3xGQDSjLj3KOXwgsMKL SSlw== 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=Ad4OTLIPpMcbeOgRn7cNcAJiN8JJ4IImE90/3zrSenU=; b=XSpnB3pwyoY/JB6ycVaVrxp/QENShmlvKWNhu3HoGmQsWw2k3fgaVtoslLk9xRfrgI vFpQwjGFlh98806nYOTOXfYkuz4oyjo2S9OotPWCZuToYLqTwdLXKiwO9+324h/ehzz0 ZEwnRGdLDuy7IeewvgPUc3cknReHqCXPMok8nZL/2ffVMPtrCqfDN8kwvCs7oC5rvA8V od8Y3mTl4P5lfxRf5GFpI81ftxDJMgiVyw6W5zu73cLQUNNY/lh6GLzB/YVT9FtS5tgU qXmzGVyEGIRu0tDs+4bVaWkRBm7T4Q3P7efU8Kt6qvo+scWvfYyiSUchRDm+shT+s4Ef 6qRQ== 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 l24-v6sor1109863wme.49.2018.07.25.15.01.53 for (Google Transport Security); Wed, 25 Jul 2018 15:01:53 -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: AAOMgpchnNwSDYXydPO96tsdnWQg2kVs8zmBXVoG3BPLNpkKwoonPv5Icvawctv1nC0wAIgER7wkZw== X-Received: by 2002:a1c:4887:: with SMTP id v129-v6mr5401757wma.129.1532556113118; Wed, 25 Jul 2018 15:01:53 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id v2-v6sm142494wrn.97.2018.07.25.15.01.51 (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 C2EEB124366; 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 3/5] mm/page_alloc: Inline function to handle CONFIG_DEFERRED_STRUCT_PAGE_INIT Date: Thu, 26 Jul 2018 00:01:42 +0200 Message-Id: <20180725220144.11531-4-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 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); }