From patchwork Tue Mar 21 17:05:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13182972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6296DC74A5B for ; Tue, 21 Mar 2023 17:06:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0101B6B007E; Tue, 21 Mar 2023 13:06:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F02FC280002; Tue, 21 Mar 2023 13:06:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF1EF280001; Tue, 21 Mar 2023 13:06:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D05CE6B007E for ; Tue, 21 Mar 2023 13:06:12 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5075A80227 for ; Tue, 21 Mar 2023 17:06:12 +0000 (UTC) X-FDA: 80593533384.22.AED02D8 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf28.hostedemail.com (Postfix) with ESMTP id 8CFEFC0017 for ; Tue, 21 Mar 2023 17:06:10 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=S6Igbn+h; spf=pass (imf28.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679418370; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=IbtPaoiXeq5fucbClMLbwcuAcxXoXBcewEj9zqQo17g=; b=v9LYGC4S/er/ScMghMKUZAzOgB8e2fDHEcQMwML10uHY8FoG2ZYPAubmp8p0/v9scsRYaI e5tDAG8s4hEi2gfU1KHMyHeLRll2b0wZZjF0p2Js2g5e0IhuRp6BT9OmYNXeC7lfhpuVLT 4r1Fjf/977YooCOaPJ9wRvGVLQSgwTw= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=S6Igbn+h; spf=pass (imf28.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679418370; a=rsa-sha256; cv=none; b=LQw1FIVBBgxRiaThufqrDfspCBy8B4xEn3tQhiDIzrcv+cOD1wMv25MIqjeN7vWJgi4g3q 7tEXn33qk0bQlvwR/zfxDMIl8U09RUaqOYb8bpMKdzB1oHFfCJTCmL0lV9XHShNfzwOdBY 26CjOKzBuy0DLbTCowA4Lqse5KaUKaI= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4F561B818F8; Tue, 21 Mar 2023 17:06:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87D0FC433EF; Tue, 21 Mar 2023 17:06:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679418367; bh=oPygRvX6RQAe+5eleW7V1m91ykfqAM2HaXq3tUgRD/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S6Igbn+hx9kvz+8nl0l0isAVjYko/QzPOG59FO2v+dyXOHfJ5CiXlxbTS8jr9Ekks Sf7vWxebifU9v9ZP2pGM8iWmX4AhTu0A+XnBUsvNJzH9MSHIh6mMOyH38kSTEidmQz qCxspDb7L34nmybV3wlEo9UdlhZxgAUiLn1f5S0xDoVvza+3nb4bSQ6sGM22c3S7En Z1XEDv6X7cynI3+638uL6VeJ2obx0l/9uZ2YtOS0sSvWrs4hPv8Sd5C42hDfm4OC5c zmNsYvjnP61UXUd+uaJKEjMbzrAMN31WrmpAUn33F4EAZgqJDhePMJeKNHwYUQz3dz i40ILUcN2Ne5Q== From: Mike Rapoport To: Andrew Morton Cc: David Hildenbrand , Doug Berger , Matthew Wilcox , Mel Gorman , Michal Hocko , Mike Rapoport , Thomas Bogendoerfer , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 10/14] init,mm: fold late call to page_ext_init() to page_alloc_init_late() Date: Tue, 21 Mar 2023 19:05:09 +0200 Message-Id: <20230321170513.2401534-11-rppt@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230321170513.2401534-1-rppt@kernel.org> References: <20230321170513.2401534-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 8CFEFC0017 X-Stat-Signature: b14nicdoe9nbyuo9aad74cg698pr6yud X-HE-Tag: 1679418370-857948 X-HE-Meta: U2FsdGVkX1/Gl0S8GwBNlw8104pQy5pgRk8vxTAwBLz0AgFNg9JG1Qo7IxGGv/C1DW+8Kvjc757JfdbQQnBxOQeQifMcBhz6TTqAUCBBtCVC1RyHIN51Ca+Xk37vW39360Oi3j19RhxEXPlML/RGUTcLfemo4FGXpKekK11DkmirlhSdIIoJe7DgTxvSTD6AD7C60tReRJVYPHm45a+E/mm5meEtmX9swhi6fNgEBtZLebmLW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BfU/sOZ/2yDGL3E4iNolxwwDT7kAUGyOr7edSRtwyWeS1OBKIIkqSDtteozMo64PTB3yPtLTuKmwwJjWlyVY+ElMi8wDDFtlNf6Spm9UY= 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: From: "Mike Rapoport (IBM)" When deferred initialization of struct pages is enabled, page_ext_init() must be called after all the deferred initialization is done, but there is no point to keep it a separate call from kernel_init_freeable() right after page_alloc_init_late(). Fold the call to page_ext_init() into page_alloc_init_late() and localize deferred_struct_pages variable. Signed-off-by: Mike Rapoport (IBM) Reviewed-by: David Hildenbrand Reviewed-by: Vlastimil Babka --- include/linux/page_ext.h | 2 -- init/main.c | 4 ---- mm/mm_init.c | 6 +++++- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/linux/page_ext.h b/include/linux/page_ext.h index bc2e39090a1f..67314f648aeb 100644 --- a/include/linux/page_ext.h +++ b/include/linux/page_ext.h @@ -29,8 +29,6 @@ struct page_ext_operations { bool need_shared_flags; }; -extern bool deferred_struct_pages; - #ifdef CONFIG_PAGE_EXTENSION /* diff --git a/init/main.c b/init/main.c index 8a20b4c25f24..04113514e56a 100644 --- a/init/main.c +++ b/init/main.c @@ -62,7 +62,6 @@ #include #include #include -#include #include #include #include @@ -1561,9 +1560,6 @@ static noinline void __init kernel_init_freeable(void) padata_init(); page_alloc_init_late(); - /* Initialize page ext after all struct pages are initialized. */ - if (deferred_struct_pages) - page_ext_init(); do_basic_setup(); diff --git a/mm/mm_init.c b/mm/mm_init.c index 43f6d3ed24ef..ff70da11e797 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -225,7 +225,7 @@ static unsigned long nr_kernel_pages __initdata; static unsigned long nr_all_pages __initdata; static unsigned long dma_reserve __initdata; -bool deferred_struct_pages __meminitdata; +static bool deferred_struct_pages __meminitdata; static DEFINE_PER_CPU(struct per_cpu_nodestat, boot_nodestats); @@ -2358,6 +2358,10 @@ void __init page_alloc_init_late(void) for_each_populated_zone(zone) set_zone_contiguous(zone); + + /* Initialize page ext after all struct pages are initialized. */ + if (deferred_struct_pages) + page_ext_init(); } #ifndef __HAVE_ARCH_RESERVED_KERNEL_PAGES