Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp840302imm; Fri, 27 Jul 2018 07:04:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeHscr0z/ygEIO0ugfozK3hhCwOJ+s0W0dQRIV5kaloB+wA8fAN2pdyMi1FVJMn2zykm09j X-Received: by 2002:a63:fc0a:: with SMTP id j10-v6mr6290464pgi.1.1532700294435; Fri, 27 Jul 2018 07:04:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532700294; cv=none; d=google.com; s=arc-20160816; b=u2tc51FoqrfG69dlSajnrbsLa/tGklBjN5ZE0lW+rMYsWxIYPoXSWPsFRXTUTqB81F YXynw3Efi9G9/GWvv/Fio/C6nEVRzqgjyRHWu5GMAIFp49Fi+cZQzbOpSYvxr8GU5S+9 hiWMI7PDzDpycO7eajjHMm/+r0wJVWPsCEX6V8I+rV1EI1EdIwsJ/oDXT0vwtJKvT2en C9hZ/jutdAfRGUBXhQ9Wpb2GaP5WNK3QUcPSwMUpj2HS8c12pMiIh3ZM3J4c6uzKZ39u Gtgy+j9UAD4O5e7x/x+KywEl2F31vONYk21/3WSsNH7riXW0fgQU/Z96qh2D0veKoA1y aBzQ== 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=FJLffSCxTL8m2I9JLIhCUa5WK/v1UH1SC12dUTyTY304ILu3g7/HgVeUyWSRwUI6oW 4ha/2smu9/k1ZZQCaxDbmMrCYB6MGwT0azryzCeaZZyEhWOeabrHNnzuHWseFbHNjCKr MdxoWGXmIGYN9OHMYcMfQxRiptOc9mLEjyNcgDHY7+fK4mHeOkilKV+ZXacZkp82udcp gC+RLBiUL+OKiSgByOp2YAz59aS0z1Wh+DQ6cESQBVLEDsqOzbC0/E3EzFMcP4CfZTqX 0BwAepdCZ0PutklJavPtnTxFsIUl23wyZ7uDzogWtXbZyU2SiWQX1nhTZXnkfLzwzeH2 H68g== 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 a3-v6si1152062plc.380.2018.07.27.07.04.39; Fri, 27 Jul 2018 07:04:54 -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 S2388712AbeG0PZn (ORCPT + 99 others); Fri, 27 Jul 2018 11:25:43 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:39478 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730561AbeG0PZk (ORCPT ); Fri, 27 Jul 2018 11:25:40 -0400 Received: by mail-wm0-f68.google.com with SMTP id h20-v6so5562423wmb.4 for ; Fri, 27 Jul 2018 07:03:35 -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=f4/fKjk3x8w/3m1xjpjMRVuxLB1+uwfu7jvo7BG9OPSUhuEC3jtdFNj+O8mIhShbCd pK2XAnDiiaNmR5Rn6/F0QcoTPO06xWdFJ0DpDhzUFArEbiLV10ZIJC+ro9msVxE++cp6 PtbWac1t8lUErJsgavJOfVEuRQfvIk3Gye5CZeK/YoXJQ0uBo4jVk3RTVCGzOj4kdXdq RGgGnA0d8FHo/KBRqax0pcfBUJZqvVpZJZeX4Dv36B+5wkcqcoWOlbpz6feuHC/AsEsR fmGemtJ+wzVEZkYOMh3SFjlfADvgqtX1n0MNzzPTmtjxBGASlB49GzOevE/kZVKNEUN/ NELg== X-Gm-Message-State: AOUpUlGOo45sAXY8463hWqxH5GUtC8AoZ+2crfKG6okB3V2siTdI89Zm tsi/9Ch+WggP+ZIAcKXPU3A= 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> 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