From patchwork Thu Jul 19 13:27:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10534421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 57B04601D2 for ; Thu, 19 Jul 2018 13:27:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40756298CC for ; Thu, 19 Jul 2018 13:27:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 342AC298DD; Thu, 19 Jul 2018 13:27:59 +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 BF941298CC for ; Thu, 19 Jul 2018 13:27:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 58C6C6B026D; Thu, 19 Jul 2018 09:27:50 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 46E066B0270; Thu, 19 Jul 2018 09:27:50 -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 2BE2F6B026F; Thu, 19 Jul 2018 09:27:50 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by kanga.kvack.org (Postfix) with ESMTP id BE1166B026D for ; Thu, 19 Jul 2018 09:27:49 -0400 (EDT) Received: by mail-wr1-f70.google.com with SMTP id u1-v6so3609571wrs.18 for ; Thu, 19 Jul 2018 06:27:49 -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=V9sPv61dSbXp1RajspAqziu2sUYE+jJab7rvMunh7Ms=; b=arYc9oe+UpyMHi7QASuDhtiKe5LG6pBo9LYBstBBEBl2b3ld5UQv67VedW5d+Qpbsx +D763BtC1pLUoHD+rBAy6WGGnJDSO0BuQdu/s4VDyzBjj9F7jyS7FW91y/7pwTKZRv+z mPeSAn/5OtB0MTdUFjJcpSnxx9a7u9LwjOOBi8czDkn+hsfVbxxTdOsB6fK+KSX2qOq7 en6kFCxAksuTvXM1Kvo3DNEnkDDPPdjqjOQ4Fo4YOR7UUTpLXRwsr8H0qqnnfcK7iYfj 7vTJvrezm1s9RbtjMYIq9YPgT49iMwz9lNegs/FpWgiUJvSL1Bd/ShaNZW1+L+Yz9H0c aqrw== 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: AOUpUlHj6XwkTD+5EGwhpwn2ujID64VqhPA5YUeH8gzESx8Qx+j+v+iN rfXOgY7gob4FK7WBt1DwAZK7/yTtDF0Cje4TyTtrQLuPV6/rLqQFURUT0P6SSCa+sbvbuBplAXg HNFZxIiA1lJvj1tg2siqGK4gnN+vo6MlBFVHz0EyrGFu20BINLlDUvEa1MHR70+b7DFPyfFUE1k BYQSc1XTESwPkq/41fQZHvJLjf/c4WpxPpp4Gx02DlUheIG0CAxoN7MdtRIo91vpRXrqdHRx65M 3GtxA1IrnPHo+Lh1kWYJmKkjPwNA64nxW5kxbJEpzUJwyVKe+XB87aOotPGv6l36EPQst9LF6d+ fG0q8+CtTAvNvEuSiAAJBhyveS+JypQSZFsurOnFUsnCdm/bCf/9aTzpZtBiGB1W23Ugy7Hpyw= = X-Received: by 2002:a1c:f46:: with SMTP id 67-v6mr4000140wmp.122.1532006869322; Thu, 19 Jul 2018 06:27:49 -0700 (PDT) X-Received: by 2002:a1c:f46:: with SMTP id 67-v6mr4000114wmp.122.1532006868518; Thu, 19 Jul 2018 06:27:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532006868; cv=none; d=google.com; s=arc-20160816; b=gdbedywpYKRGdWq4l58xoAUy64Le0g+6hg7VTBGjkUwRlTEc9CpQvgnbiEpXpYOKkx SoSGPSPA3oAe150AQogu/vH5vfB2wpMyu3t/n0IKxQTfWGggEWUEes0UqqnLUjtAIY1f WXVnZE7seThYv8+EQRXLD7YbnKbEfpUga9jtxyMk/rLWq3Yyi+/gSAcOYwfY9ehmGg/5 ouTjtohAtub+EToJ4ZXm5hw02lGID41onGPBtvYAz11FJfM7vWIv2BkckPxiXaXpRGl5 F0BBaA+EQrYIyQaC+m/uNd9bIk5lS2EXPJ1e8nH4oA5lO0lQTGpkQQyh7mNUlvpYZodb js8A== 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=V9sPv61dSbXp1RajspAqziu2sUYE+jJab7rvMunh7Ms=; b=V/Z4Y+DLVQuWktoFVQK9iRDj4ONbZ91lBMNGYiAUkK/A8Bn7Sfk3WR0w78FTCTH4vL Y5HstBtN6A+XdrnxTb55fTGSR0eJCAlHmeu5GB9GPzssaHtLxNcspbNC0FDZMU/ph9Ot ffpfss/sE9+jSelekUBnCHeN4URTyeb74VC7298RQHqf3HqPU9ux5g8/tXRSL8qZ4PSy yL2jICVPtd08Xlj/1h3IsxWY1r05ep6lOHi2HKUfygaMHtZr7lTxAgw+q7/RHx+h2dN1 IEkBq/HUQkCAMPDnz32ew4+JmmqQvTsMUfvIVtrKjKSvtvJo8qrn2o07q0CiWLN+SfMK RluQ== 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 i8-v6sor2955501wro.21.2018.07.19.06.27.48 for (Google Transport Security); Thu, 19 Jul 2018 06:27:48 -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: AAOMgpc7mDDlEubeV62EUL13KC+IMGzgKJsmecnj4wBCczDkevfxaHF4L2Adv7uO1eC2R5AfWol0OQ== X-Received: by 2002:adf:ad45:: with SMTP id p63-v6mr7306736wrc.222.1532006868257; Thu, 19 Jul 2018 06:27:48 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id t13-v6sm7047370wrr.74.2018.07.19.06.27.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 06:27:47 -0700 (PDT) Received: from d104.suse.de (charybdis-ext.suse.de [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id 58EEC124175; Thu, 19 Jul 2018 15:27:45 +0200 (CEST) From: osalvador@techadventures.net To: akpm@linux-foundation.org Cc: pasha.tatashin@oracle.com, mhocko@suse.com, vbabka@suse.cz, aaron.lu@intel.com, iamjoonsoo.kim@lge.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Oscar Salvador Subject: [PATCH v2 4/5] mm/page_alloc: Inline function to handle CONFIG_DEFERRED_STRUCT_PAGE_INIT Date: Thu, 19 Jul 2018 15:27:39 +0200 Message-Id: <20180719132740.32743-5-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180719132740.32743-1-osalvador@techadventures.net> References: <20180719132740.32743-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. Signed-off-by: Oscar Salvador Acked-by: Michal Hocko --- 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 f7a6f4e13f41..d77bc2a7ec2c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6379,6 +6379,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) { @@ -6404,16 +6419,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); }