From patchwork Sun Mar 19 22:00:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13180640 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 2F5C4C7618A for ; Sun, 19 Mar 2023 22:01:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BBC5F90000E; Sun, 19 Mar 2023 18:01:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B1E81900002; Sun, 19 Mar 2023 18:01:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 998B890000E; Sun, 19 Mar 2023 18:01:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8CE6E900002 for ; Sun, 19 Mar 2023 18:01:07 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 58F2C1C5D9E for ; Sun, 19 Mar 2023 22:01:07 +0000 (UTC) X-FDA: 80587018974.05.1623D34 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf17.hostedemail.com (Postfix) with ESMTP id E3D5740016 for ; Sun, 19 Mar 2023 22:01:03 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kOd7Gv5m; spf=pass (imf17.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 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=1679263264; 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=NoiMHve7UWm4zfnV54oLaYQeRCeC+o6mPLSSjHXn11s=; b=ZKQcBxvvP6miHk4YTd/OHhmUNo/4PQ9iv7OotERTWWIO6IOhEPHJuEO5i0yACXLDPKAdyx PZ51yCDLQCB2PkY7DY89bqqiYaid0M4jBA40Xw6yblScfNyBhajkfowzNOaei0FT5j4Inq dyk7JaNDam2bm3RVp56bE4Jrw4+/f+0= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kOd7Gv5m; spf=pass (imf17.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 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=1679263264; a=rsa-sha256; cv=none; b=7BhQVYSEyJooJlwHHlIglT28RkKbgCYx27aIY5zD3v/H5FUUvqilP9KpYXocTAS34ucemZ Pi3bDfLbw11oGHdRDSIkXDavlkmBTc2gUa7Cj7/m11Y2Vmf4e63E53wEiTesxuVzIAQgJU 8vXT+FeCbkUEjAkoe0cjoHRn9wzgOPk= 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 dfw.source.kernel.org (Postfix) with ESMTPS id EFBCE611CC; Sun, 19 Mar 2023 22:01:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AD33C4339E; Sun, 19 Mar 2023 22:00:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679263262; bh=967+3O+np6cjBUo4maqL5M/MoNfM+0xG04PeQyxPgnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kOd7Gv5m/2xJyFfcUY6qVcv/DS05Vhxg28CbZOm1yHQ8fQBZrEnyLXI8A/BQZeAVZ PiLJw4jUvUeh7VaCBe65lOjWv7ahlTb+Fn1ZrLZwGyD378pSK1SbVtsoc0an9Lh4To FkUFTbGuvHM1w9iM5uRBWUoWg1PHTZSbtCAaLguK2MNva5sczzZzcZVgudK4IbAyxE rS8rd/XjLwVGlHY+lX6zVm16lXK5HMqkj9j5FNiJbWbTXEHmTe4jWaAK+8sQPvHZpy F99UJ4JCko9T5QC93h8zgGRLd+q32X01F9a2FQSVyrnb+W9Sx+cHhHLpcMo2c97KgO MOV+qAjnx9eJg== From: Mike Rapoport To: Andrew Morton Cc: David Hildenbrand , 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 11/15] init,mm: fold late call to page_ext_init() to page_alloc_init_late() Date: Mon, 20 Mar 2023 00:00:04 +0200 Message-Id: <20230319220008.2138576-12-rppt@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230319220008.2138576-1-rppt@kernel.org> References: <20230319220008.2138576-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: E3D5740016 X-Stat-Signature: ja6iiq5bgu57as5sn5amb5drc5wb71ot X-Rspam-User: X-HE-Tag: 1679263263-703024 X-HE-Meta: U2FsdGVkX1/85yKi/KK0MIzd0vWk2AD5i7DElBxFHUjyT/BSJWntn3FW+qrQhzEj84XMOoUEUVFhaatOMLIdx+We2Qr7xPJS4g62hoFqr+S3rkdCZGhmfmumQzRk0Ws1tAVD1Dnz9Ubj+gw/cRVYO63N8MjspARmveJEru2+aVEWs5K8zrB11OSPgg56Rlsi1G4dWL1DpXM+UlfE4SFA4s6ydFjd5K23voTHrsanA/zqwfj0y9uo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w3zOpK9CTniqSX4dIMY9OoFN29NM8GBIUVGTpGzdR1T6TuGE+0DxbezIftAPIUg673y9kCpuW9hAsKqiVFvLCXuYMk2WPhkAN0wmFDgTEC97hd5g== 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 --- 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 ae6bd26cf5a2..2d73d8b05a69 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); @@ -2338,6 +2338,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