From patchwork Wed Aug 1 12:23:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10552229 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 317E413B8 for ; Wed, 1 Aug 2018 12:24:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 202A72AB8A for ; Wed, 1 Aug 2018 12:24:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 145B02AC1E; Wed, 1 Aug 2018 12:24:12 +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 9EAB42AB8A for ; Wed, 1 Aug 2018 12:24:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A15C86B0006; Wed, 1 Aug 2018 08:24:00 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 98D906B0266; Wed, 1 Aug 2018 08:24:00 -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 793D86B0006; Wed, 1 Aug 2018 08:24:00 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f70.google.com (mail-wm0-f70.google.com [74.125.82.70]) by kanga.kvack.org (Postfix) with ESMTP id 0ACFA6B0007 for ; Wed, 1 Aug 2018 08:24:00 -0400 (EDT) Received: by mail-wm0-f70.google.com with SMTP id y13-v6so3620652wma.1 for ; Wed, 01 Aug 2018 05:23:59 -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=oO/r0b2f7XB/e6iVHlV69GT6OlFJSDIymKWsErYI290=; b=uh6VpsSDw8azc7b0ZuNHQUNdUq06hbY6kwOtn6dB2JH/UHOVrYysiPOUVcMnqFrxy6 bhwVirLB+djzLnhQiZhZ601qQhrRE1eM1Sr5sLPLfou8Y61+2rb/816yOTIIuCAka5c+ C6JCrWFWxq604rgdFzHxuRMfxJK+Fn35Pp5H9L7ego0oFerbyv+5g4o8/QA4aIg27xP8 1CWiR47B7yR7L2gICDZ9YJoh1jHSV8FDtyeIOpbQExBH5CFKXfM5ExBc+MLJ8GO8nXgm jNyy5Kfrx0puT5uKq/UQ0GdZ40WcjMCqGcLAF77QqT23CqZWg7kVmbV1A9c87loGxAnV 2oPQ== 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: AOUpUlHRN5axovSm73bTgla4DwHcWeCUFe4kQ6L9No33Bf9co+EZPGjw v9sQ6/FjvInalva/cyLLbTJ2ns22Q8/eKI+E09DviM0DEP6nHXBgfwaNdTRkjhBhZLpMnK+N1Ee xopO8Jaf/cPpvpnm8ts8hhEpFYmWNl8TPdj1nQJsHewC9qdQT8Uec+/ofePsxsNP9zNcj6qLtHx VWCoNAH3zLBP0W/CnOE+P+EeeAi5807j56LGjza+Z+fSUUlsVe7iJeHZ/xA+wniHZ8JDAlZz/ek 0eSvDEoL3Ruf43eM7yeaqzm8R9coseR9IfAcKQ7OKwVowG6gfBir5vApHpIBxPjSPg7YVRCBWxV RhTUSltoTgwGirHVmcMVg661AB0Ly3uiDV/UuFWw2/snWZFIyxKljldln7if2YC65FmeUrSdlA= = X-Received: by 2002:a1c:c3c4:: with SMTP id t187-v6mr2727254wmf.123.1533126239596; Wed, 01 Aug 2018 05:23:59 -0700 (PDT) X-Received: by 2002:a1c:c3c4:: with SMTP id t187-v6mr2727219wmf.123.1533126238718; Wed, 01 Aug 2018 05:23:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533126238; cv=none; d=google.com; s=arc-20160816; b=t/8DWRvB9LhJqfGesawcvwrjoE9aE7wlINUO6uCpYl3zmyF2jWqSl/q7pQGPZAVvq0 BLXIygWMmubk/6O6JhxZp8BGrrDhSnoOVaPOKwLY9mmx9B9NIqDFrk0sqQDLCsa5U0+R bXuAY1E7SdBJkOVltkXs0a3p2qMxmdoPkfRujJmsjZLbh2loVxfbEX5tDLUuV+3I5Vly PDSu5tvk54n/eZKvjLK5YR9CEL2eAod7tX6t8ETt7Z1j4/MDfp/fv0GaK2pM811iuQA+ fmpHqavxN1hnZcNY3B7+jRFYMCIqvmrW7SqMVSEIaGCVVPXDIoBOWxLlh97I+cgx3oVi E6ug== 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=oO/r0b2f7XB/e6iVHlV69GT6OlFJSDIymKWsErYI290=; b=VjCyMmDW2VeVSwNbgdSExQU0ChFy7Cr/LZLCRMwX00PSJomqcFZWNwez11SD/0QXzm R5HvoENs9tNhswXqDb52A8ay/ZM4XnBFn2V+fk5rmCqquyjDAhEsaJKVTcCevxtv/WpH ysl2eVsSYH0rpXPHGqdP2nx/hQZVFISIrNZqJ8wU+pWDStQULzk1XUHTN7pgBBgWwRHx ZR3jBTD1Op4M3QX44YUAwqns5b6/wRTlXmP+Il9WzKMOPIKisvpUAdNvw4HhznQmI4s+ 6leT8tblqkG3R8sQNz3wIESpyNUGjSSIEscaAWcAcxtlmcpfoKdhMrhlgVmZ9zsF+zU3 z9ug== 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 l138-v6sor1396053wma.65.2018.08.01.05.23.58 for (Google Transport Security); Wed, 01 Aug 2018 05:23:58 -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: AAOMgpdwKtW4RSPjIIzre19SBdCLL2SBkcN3WtX94xVqaMazVDQ3gARceeTHShFhQBhk8mRG+CMKUg== X-Received: by 2002:a1c:4d16:: with SMTP id o22-v6mr2506449wmh.49.1533126238433; Wed, 01 Aug 2018 05:23:58 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id l16-v6sm1090486wmc.38.2018.08.01.05.23.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Aug 2018 05:23:56 -0700 (PDT) Received: from d104.suse.de (nat.nue.novell.com [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id 73865124542; Wed, 1 Aug 2018 14:23:55 +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 v6 4/5] mm/page_alloc: Inline function to handle CONFIG_DEFERRED_STRUCT_PAGE_INIT Date: Wed, 1 Aug 2018 14:23:47 +0200 Message-Id: <20180801122348.21588-5-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180801122348.21588-1-osalvador@techadventures.net> References: <20180801122348.21588-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 Acked-by: Vlastimil Babka --- mm/page_alloc.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 607f98f8816d..56ee8c029759 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6366,6 +6366,22 @@ 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 __meminit free_area_init_node(int nid, unsigned long *zones_size, unsigned long node_start_pfn, unsigned long *zholes_size) @@ -6392,16 +6408,8 @@ void __meminit 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); }