Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2195549/?format=api
{ "id": 2195549, "url": "http://patchwork.ozlabs.org/api/patches/2195549/?format=api", "web_url": "http://patchwork.ozlabs.org/project/sparclinux/patch/20260211103141.3215197-5-rppt@kernel.org/", "project": { "id": 10, "url": "http://patchwork.ozlabs.org/api/projects/10/?format=api", "name": "Linux SPARC Development ", "link_name": "sparclinux", "list_id": "sparclinux.vger.kernel.org", "list_email": "sparclinux@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260211103141.3215197-5-rppt@kernel.org>", "list_archive_url": null, "date": "2026-02-11T10:31:41", "name": "[v3,4/4] mm: cache struct page for empty_zero_page and return it from ZERO_PAGE()", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "baf6fe3ba580b9c63c19666cea46e5b0bea257d5", "submitter": { "id": 77733, "url": "http://patchwork.ozlabs.org/api/people/77733/?format=api", "name": "Mike Rapoport", "email": "rppt@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/sparclinux/patch/20260211103141.3215197-5-rppt@kernel.org/mbox/", "series": [ { "id": 491817, "url": "http://patchwork.ozlabs.org/api/series/491817/?format=api", "web_url": "http://patchwork.ozlabs.org/project/sparclinux/list/?series=491817", "date": "2026-02-11T10:31:37", "name": "arch, mm: consolidate empty_zero_page", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/491817/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2195549/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2195549/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <SRS0=vAva=AP=vger.kernel.org=sparclinux+bounces-6262-patchwork-incoming=ozlabs.org@ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "sparclinux@vger.kernel.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "patchwork-incoming@ozlabs.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=VUycx2g0;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=vava=ap=vger.kernel.org=sparclinux+bounces-6262-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)", "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c0a:e001:db::12fc:5321\"\n arc.chain=subspace.kernel.org", "gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org", "gandalf.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=VUycx2g0;\n\tdkim-atps=neutral", "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=sparclinux+bounces-6262-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"VUycx2g0\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201" ], "Received": [ "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4f9vy61xtdz1xtV\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 11 Feb 2026 21:37:18 +1100 (AEDT)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4f9vy61S9Tz4w0p\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 11 Feb 2026 21:37:18 +1100 (AEDT)", "by gandalf.ozlabs.org (Postfix)\n\tid 4f9vy61N6dz4w2R; Wed, 11 Feb 2026 21:37:18 +1100 (AEDT)", "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4f9vy25kJ2z4w0p\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 11 Feb 2026 21:37:14 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 09A7030A0075\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 11 Feb 2026 10:32:52 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id C8A0C369204;\n\tWed, 11 Feb 2026 10:32:50 +0000 (UTC)", "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F04A331A5C;\n\tWed, 11 Feb 2026 10:32:50 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id F37C2C2BCAF;\n\tWed, 11 Feb 2026 10:32:38 +0000 (UTC)" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1770806238; cv=pass;\n\tb=x6gCo2qwBiutAw5JHEKMTCJXomFnjVxfBkd7sbF/xqeHOOehcFzalzXLCuXm2xrTipU56J/CvjEdiNhHvKC6C0VCaYCie8IaRG5RpWN1oYbvMkSTBKGVfIcSy6eYzhcGV9zsiVLzE75/mEqz8MIHDrL3lkUuSKH+65327hH7u0vAyZ7JZ44AfjRdpDxENjnH+GZlUe18erw8lGrZ3dW1HvXiMAqBeJje4WbdXnpcwhpWnmCqzAPcdpelQb6oJBmJTNPPy8rID4zLTtQDtN5d6zPjaURHNubgU1vxo+lUVuB/R0y5LhMBNAzZ1nPygBdjSynaJqRGFBXN3HLPtfU1BQ==", "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1770805970; cv=none;\n b=p5pLv7C2yvEP1uSsV3zD15Du1QdBl+lGTFBldLmpskXN7R9urFdyAPxM2xku+UwPXAycMVzxGtIHl+t3jQrhVJ/SRNx4srWyWc7XRKgTQuk4CVkPfblBsxxB75BrJT5lmTQb5ft7OuU1R38B3ezPMgWa5DEcWL0pmGALHQdzg9g=" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1770806238; c=relaxed/relaxed;\n\tbh=WoHQIuiEqdW57fPr0bquSmA5wnTLfNUngV079oNlBzU=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=s4MUsEwcKfDKXvI6a55YUpYsIUJsVgfgWgPJcloQxjr5f1Z4TR7QeO1GBZhdFnqgFNnvIaafSGV9Cp53RTwZQXSotXM9gwqipOakyXv5UaL/BB/vqM6v8xArtJwS6nXMFWvvz5XhyuFkA6DQyQ53hBQEXK37w3/LTGBLR4KtMer8SFqsM4lCOPk2x+sNPVVm9+eBXvy6DdXD7CmCfLRnRLo09jyOciUOtARJ5F5ip63tGwKqNUweftBNIyjktIeOd/XrKSgsRHA99smFTGgIqpVQjarWzvZG/utHuhw0jXV12SuaPOfg6jlvjRSG/XYJZQCh7nYbvBtqllTexP3/jA==", "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1770805970; c=relaxed/simple;\n\tbh=WXj3bDUynhmJwIWcqszyv0wbTX5I8QPCpk4+eeqSnq4=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=o8yO4biMYXU1a7O5CG/ZYFkxfUzu3a6aLregohfL7dIgPHc+5KW2IWLHV9TUt7B6OpqLj2D+o91Imo9e5OHy3RfS7c+RRDcWC8Y4zs1jtcA8QWW++NcLsrpkVSkJWUmGcCVE7S1u17jVQptJvF0CxHtjCkaFHL+WynhBx+BG+ck=" ], "ARC-Authentication-Results": [ "i=2; gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org;\n dkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=VUycx2g0; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=sparclinux+bounces-6262-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org", "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=VUycx2g0; arc=none smtp.client-ip=10.30.226.201" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1770805970;\n\tbh=WXj3bDUynhmJwIWcqszyv0wbTX5I8QPCpk4+eeqSnq4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=VUycx2g0refsXHYPZVpEU+UC7PHYsiruAyCk0E2NjULDdTGpkmomFQafKHUOTFGfN\n\t gxdwH68dJxpGp5uoQ4bCIYVF9q/ZtWZyBrRXQKklHUNBBv4tXopKimIWb6HO1xITWD\n\t v5Le7kpV2WyO2ymXn0Iru7RhLgig1FDLpKEZLiaW4uloDE3fqoRPWZQHcg4WZLcxzC\n\t Dem6wAhAyVX6Jeh2Hi5hO5aKu49m5ADtB9baTMfm2NL2MQ5Xgny2uugfwPkwNfT/Sh\n\t 55TTMaB6nztE9wmgPYA3G+uvSqqAXPlhRNT70FMQNqDaWyvoaKR0G5d15Xri9RCkaK\n\t z/9dYoHmO4k7Q==", "From": "Mike Rapoport <rppt@kernel.org>", "To": "Andrew Morton <akpm@linux-foundation.org>", "Cc": "Andreas Larsson <andreas@gaisler.com>,\n\tBorislav Petkov <bp@alien8.de>,\n\tBrian Cain <bcain@kernel.org>,\n\tCatalin Marinas <catalin.marinas@arm.com>,\n\t\"Christophe Leroy (CS GROUP)\" <chleroy@kernel.org>,\n\t\"David S. Miller\" <davem@davemloft.net>,\n\tDave Hansen <dave.hansen@linux.intel.com>,\n\tDavid Hildenbrand <david@kernel.org>,\n\tDinh Nguyen <dinguyen@kernel.org>,\n\tGeert Uytterhoeven <geert@linux-m68k.org>,\n\tGuo Ren <guoren@kernel.org>,\n\tHelge Deller <deller@gmx.de>,\n\tHuacai Chen <chenhuacai@kernel.org>,\n\tIngo Molnar <mingo@redhat.com>,\n\tJohannes Berg <johannes@sipsolutions.net>,\n\tJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,\n\t\"Liam R. Howlett\" <Liam.Howlett@oracle.com>,\n\tLorenzo Stoakes <lorenzo.stoakes@oracle.com>,\n\tMadhavan Srinivasan <maddy@linux.ibm.com>,\n\tMagnus Lindholm <linmag7@gmail.com>,\n\tMatt Turner <mattst88@gmail.com>,\n\tMax Filippov <jcmvbkbc@gmail.com>,\n\tMichael Ellerman <mpe@ellerman.id.au>,\n\tMichal Hocko <mhocko@suse.com>,\n\tMichal Simek <monstr@monstr.eu>,\n\tMike Rapoport <rppt@kernel.org>,\n\tPalmer Dabbelt <palmer@dabbelt.com>,\n\tRichard Weinberger <richard@nod.at>,\n\tRussell King <linux@armlinux.org.uk>,\n\tStafford Horne <shorne@gmail.com>,\n\tSuren Baghdasaryan <surenb@google.com>,\n\tThomas Gleixner <tglx@kernel.org>,\n\tVineet Gupta <vgupta@kernel.org>,\n\tVlastimil Babka <vbabka@suse.cz>,\n\tWill Deacon <will@kernel.org>,\n\tlinux-alpha@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tlinux-snps-arc@lists.infradead.org,\n\tlinux-arm-kernel@lists.infradead.org,\n\tlinux-csky@vger.kernel.org,\n\tlinux-hexagon@vger.kernel.org,\n\tloongarch@lists.linux.dev,\n\tlinux-m68k@lists.linux-m68k.org,\n\tlinux-openrisc@vger.kernel.org,\n\tlinux-parisc@vger.kernel.org,\n\tlinuxppc-dev@lists.ozlabs.org,\n\tlinux-riscv@lists.infradead.org,\n\tlinux-sh@vger.kernel.org,\n\tsparclinux@vger.kernel.org,\n\tlinux-um@lists.infradead.org,\n\tlinux-mm@kvack.org,\n\tx86@kernel.org", "Subject": "[PATCH v3 4/4] mm: cache struct page for empty_zero_page and return\n it from ZERO_PAGE()", "Date": "Wed, 11 Feb 2026 12:31:41 +0200", "Message-ID": "<20260211103141.3215197-5-rppt@kernel.org>", "X-Mailer": "git-send-email 2.51.0", "In-Reply-To": "<20260211103141.3215197-1-rppt@kernel.org>", "References": "<20260211103141.3215197-1-rppt@kernel.org>", "Precedence": "bulk", "X-Mailing-List": "sparclinux@vger.kernel.org", "List-Id": "<sparclinux.vger.kernel.org>", "List-Subscribe": "<mailto:sparclinux+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:sparclinux+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Spam-Status": "No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tMAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1", "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org" }, "content": "From: \"Mike Rapoport (Microsoft)\" <rppt@kernel.org>\n\nFor most architectures every invocation of ZERO_PAGE() does\nvirt_to_page(empty_zero_page). But empty_zero_page is in BSS and it is\nenough to get its struct page once at initialization time and then use\nit whenever a zero page should be accessed.\n\nAdd yet another __zero_page variable that will be initialized as\nvirt_to_page(empty_zero_page) for most architectures in a weak\narch_setup_zero_pages() function.\n\nFor architectures that use colored zero pages (MIPS and s390) rename their\nsetup_zero_pages() to arch_setup_zero_pages() and make it global rather\nthan static.\n\nFor architectures that cannot use virt_to_page() for BSS (arm64 and\nsparc64) add override of arch_setup_zero_pages().\n\nAcked-by: Catalin Marinas <catalin.marinas@arm.com>\nSigned-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>\n---\n arch/arm64/include/asm/pgtable.h | 6 ------\n arch/arm64/mm/init.c | 5 +++++\n arch/mips/mm/init.c | 11 +----------\n arch/s390/mm/init.c | 4 +---\n arch/sparc/include/asm/pgtable_64.h | 3 ---\n arch/sparc/mm/init_64.c | 17 +++++++----------\n include/linux/pgtable.h | 11 ++++++++---\n mm/mm_init.c | 21 +++++++++++++++++----\n 8 files changed, 39 insertions(+), 39 deletions(-)", "diff": "diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h\nindex 63da07398a30..2c1ec7cc8612 100644\n--- a/arch/arm64/include/asm/pgtable.h\n+++ b/arch/arm64/include/asm/pgtable.h\n@@ -106,12 +106,6 @@ static inline void arch_leave_lazy_mmu_mode(void)\n #define flush_tlb_fix_spurious_fault_pmd(vma, address, pmdp)\t\\\n \tlocal_flush_tlb_page_nonotify(vma, address)\n \n-/*\n- * ZERO_PAGE is a global shared page that is always zero: used\n- * for zero-mapped memory areas etc..\n- */\n-#define ZERO_PAGE(vaddr)\tphys_to_page(__pa_symbol(empty_zero_page))\n-\n #define pte_ERROR(e)\t\\\n \tpr_err(\"%s:%d: bad pte %016llx.\\n\", __FILE__, __LINE__, pte_val(e))\n \ndiff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c\nindex 96711b8578fd..417ec7efe569 100644\n--- a/arch/arm64/mm/init.c\n+++ b/arch/arm64/mm/init.c\n@@ -328,6 +328,11 @@ void __init bootmem_init(void)\n \tmemblock_dump_all();\n }\n \n+void __init arch_setup_zero_pages(void)\n+{\n+\t__zero_page = phys_to_page(__pa_symbol(empty_zero_page));\n+}\n+\n void __init arch_mm_preinit(void)\n {\n \tunsigned int flags = SWIOTLB_VERBOSE;\ndiff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c\nindex 4f6449ad02ca..55b25e85122a 100644\n--- a/arch/mips/mm/init.c\n+++ b/arch/mips/mm/init.c\n@@ -56,10 +56,7 @@ unsigned long empty_zero_page, zero_page_mask;\n EXPORT_SYMBOL_GPL(empty_zero_page);\n EXPORT_SYMBOL(zero_page_mask);\n \n-/*\n- * Not static inline because used by IP27 special magic initialization code\n- */\n-static void __init setup_zero_pages(void)\n+void __init arch_setup_zero_pages(void)\n {\n \tunsigned int order;\n \n@@ -450,7 +447,6 @@ void __init arch_mm_preinit(void)\n \tBUILD_BUG_ON(IS_ENABLED(CONFIG_32BIT) && (PFN_PTE_SHIFT > PAGE_SHIFT));\n \n \tmaar_init();\n-\tsetup_zero_pages();\t/* Setup zeroed pages. */\n \thighmem_init();\n \n #ifdef CONFIG_64BIT\n@@ -461,11 +457,6 @@ void __init arch_mm_preinit(void)\n \t\t\t\t0x80000000 - 4, KCORE_TEXT);\n #endif\n }\n-#else /* CONFIG_NUMA */\n-void __init arch_mm_preinit(void)\n-{\n-\tsetup_zero_pages();\t/* This comes from node 0 */\n-}\n #endif /* !CONFIG_NUMA */\n \n void free_init_pages(const char *what, unsigned long begin, unsigned long end)\ndiff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c\nindex 3c20475cbee2..1f72efc2a579 100644\n--- a/arch/s390/mm/init.c\n+++ b/arch/s390/mm/init.c\n@@ -69,7 +69,7 @@ unsigned long empty_zero_page, zero_page_mask;\n EXPORT_SYMBOL(empty_zero_page);\n EXPORT_SYMBOL(zero_page_mask);\n \n-static void __init setup_zero_pages(void)\n+void __init arch_setup_zero_pages(void)\n {\n \tunsigned long total_pages = memblock_estimated_nr_free_pages();\n \tunsigned int order;\n@@ -159,8 +159,6 @@ void __init arch_mm_preinit(void)\n \tcpumask_set_cpu(0, mm_cpumask(&init_mm));\n \n \tpv_init();\n-\n-\tsetup_zero_pages();\t/* Setup zeroed pages. */\n }\n \n unsigned long memory_block_size_bytes(void)\ndiff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h\nindex 615f460c50af..74ede706fb32 100644\n--- a/arch/sparc/include/asm/pgtable_64.h\n+++ b/arch/sparc/include/asm/pgtable_64.h\n@@ -210,9 +210,6 @@ extern unsigned long _PAGE_CACHE;\n extern unsigned long pg_iobits;\n extern unsigned long _PAGE_ALL_SZ_BITS;\n \n-extern struct page *mem_map_zero;\n-#define ZERO_PAGE(vaddr)\t(mem_map_zero)\n-\n /* PFNs are real physical page numbers. However, mem_map only begins to record\n * per-page information starting at pfn_base. This is to handle systems where\n * the first physical page in the machine is at some huge physical address,\ndiff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c\nindex 0cc8de2fea90..707c1df67d79 100644\n--- a/arch/sparc/mm/init_64.c\n+++ b/arch/sparc/mm/init_64.c\n@@ -177,9 +177,6 @@ extern unsigned long sparc_ramdisk_image64;\n extern unsigned int sparc_ramdisk_image;\n extern unsigned int sparc_ramdisk_size;\n \n-struct page *mem_map_zero __read_mostly;\n-EXPORT_SYMBOL(mem_map_zero);\n-\n unsigned int sparc64_highest_unlocked_tlb_ent __read_mostly;\n \n unsigned long sparc64_kern_pri_context __read_mostly;\n@@ -2496,11 +2493,17 @@ static void __init register_page_bootmem_info(void)\n \t\t\tregister_page_bootmem_info_node(NODE_DATA(i));\n #endif\n }\n-void __init mem_init(void)\n+\n+void __init arch_setup_zero_pages(void)\n {\n \tphys_addr_t zero_page_pa = kern_base +\n \t\t((unsigned long)&empty_zero_page[0] - KERNBASE);\n \n+\t__zero_page = phys_to_page(zero_page_pa);\n+}\n+\n+void __init mem_init(void)\n+{\n \t/*\n \t * Must be done after boot memory is put on freelist, because here we\n \t * might set fields in deferred struct pages that have not yet been\n@@ -2509,12 +2512,6 @@ void __init mem_init(void)\n \t */\n \tregister_page_bootmem_info();\n \n-\t/*\n-\t * Set up the zero page, mark it reserved, so that page count\n-\t * is not manipulated when freeing the page from user ptes.\n-\t */\n-\tmem_map_zero = pfn_to_page(PHYS_PFN(zero_page_pa));\n-\n \tif (tlb_type == cheetah || tlb_type == cheetah_plus)\n \t\tcheetah_ecache_flush_init();\n }\ndiff --git a/include/linux/pgtable.h b/include/linux/pgtable.h\nindex 3d48eea57cd2..1da21ec62836 100644\n--- a/include/linux/pgtable.h\n+++ b/include/linux/pgtable.h\n@@ -1894,6 +1894,8 @@ static inline void pfnmap_setup_cachemode_pfn(unsigned long pfn, pgprot_t *prot)\n * For architectures that don't __HAVE_COLOR_ZERO_PAGE the zero page lives in\n * empty_zero_page in BSS.\n */\n+void arch_setup_zero_pages(void);\n+\n #ifdef __HAVE_COLOR_ZERO_PAGE\n static inline int is_zero_pfn(unsigned long pfn)\n {\n@@ -1921,10 +1923,13 @@ static inline unsigned long zero_pfn(unsigned long addr)\n }\n \n extern uint8_t empty_zero_page[PAGE_SIZE];\n+extern struct page *__zero_page;\n \n-#ifndef ZERO_PAGE\n-#define ZERO_PAGE(vaddr) ((void)(vaddr),virt_to_page(empty_zero_page))\n-#endif\n+static inline struct page *_zero_page(unsigned long addr)\n+{\n+\treturn __zero_page;\n+}\n+#define ZERO_PAGE(vaddr) _zero_page(vaddr)\n \n #endif /* __HAVE_COLOR_ZERO_PAGE */\n \ndiff --git a/mm/mm_init.c b/mm/mm_init.c\nindex 1eac634ece1a..b08608c1b71d 100644\n--- a/mm/mm_init.c\n+++ b/mm/mm_init.c\n@@ -59,7 +59,10 @@ EXPORT_SYMBOL(zero_page_pfn);\n #ifndef __HAVE_COLOR_ZERO_PAGE\n uint8_t empty_zero_page[PAGE_SIZE] __page_aligned_bss;\n EXPORT_SYMBOL(empty_zero_page);\n-#endif\n+\n+struct page *__zero_page __ro_after_init;\n+EXPORT_SYMBOL(__zero_page);\n+#endif /* __HAVE_COLOR_ZERO_PAGE */\n \n #ifdef CONFIG_DEBUG_MEMORY_INIT\n int __meminitdata mminit_loglevel;\n@@ -2675,12 +2678,21 @@ static void __init mem_init_print_info(void)\n \t\t);\n }\n \n-static int __init init_zero_page_pfn(void)\n+#ifndef __HAVE_COLOR_ZERO_PAGE\n+/*\n+ * architectures that __HAVE_COLOR_ZERO_PAGE must define this function\n+ */\n+void __init __weak arch_setup_zero_pages(void)\n+{\n+\t__zero_page = virt_to_page(empty_zero_page);\n+}\n+#endif\n+\n+static void __init init_zero_page_pfn(void)\n {\n+\tarch_setup_zero_pages();\n \tzero_page_pfn = page_to_pfn(ZERO_PAGE(0));\n-\treturn 0;\n }\n-early_initcall(init_zero_page_pfn);\n \n void __init __weak arch_mm_preinit(void)\n {\n@@ -2704,6 +2716,7 @@ void __init mm_core_init_early(void)\n void __init mm_core_init(void)\n {\n \tarch_mm_preinit();\n+\tinit_zero_page_pfn();\n \n \t/* Initializations relying on SMP setup */\n \tBUILD_BUG_ON(MAX_ZONELISTS > 2);\n", "prefixes": [ "v3", "4/4" ] }