From: Eric Curtin <ericcurtin17@gmail.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Ryan Roberts <ryan.roberts@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
David Hildenbrand <david@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>, Michal Hocko <mhocko@suse.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org
Subject: [RFC PATCH v2 25/43] arm64: Size and align the zero page and FDT ptes for PAGE_SIZE_MAX
Date: Tue, 1 Dec 2026 01:51:57 +0000 [thread overview]
Message-ID: <20261201015240.1017259-26-ericcurtin17@gmail.com> (raw)
In-Reply-To: <20261201015240.1017259-1-ericcurtin17@gmail.com>
From: Ryan Roberts <ryan.roberts@arm.com>
The zero page and the page table buffer used to map the FDT during early
boot have to be big enough and aligned for whichever page size is
selected at boot, so declare them for PAGE_SIZE_MAX instead of
PAGE_SIZE. This affects empty_zero_page and its declaration in
linux/pgtable.h, and the ptes array in map_fdt().
For a compile-time page size PAGE_SIZE_MAX equals PAGE_SIZE and there is
no functional change. For a boot-time page size, unused memory could be
freed once the page size is known, but that is not done here.
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
(cherry picked from commit 5394b3c8ab37b41a0e4943c2b0f8220fc63a07a6)
---
arch/arm64/kernel/pi/map_kernel.c | 2 +-
include/linux/pgtable.h | 2 +-
mm/mm_init.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/kernel/pi/map_kernel.c b/arch/arm64/kernel/pi/map_kernel.c
index fa3549701927..16f12fa8c890 100644
--- a/arch/arm64/kernel/pi/map_kernel.c
+++ b/arch/arm64/kernel/pi/map_kernel.c
@@ -213,7 +213,7 @@ static void __init remap_idmap(bool use_lpa2, int page_shift)
static void *__init map_fdt(phys_addr_t fdt, int page_shift)
{
- static u8 ptes[INIT_IDMAP_FDT_SIZE_MAX] __initdata __aligned(PAGE_SIZE);
+ static u8 ptes[INIT_IDMAP_FDT_SIZE_MAX] __initdata __aligned(PAGE_SIZE_MAX);
static bool first_time __initdata = true;
u64 limit = (u64)&ptes[INIT_IDMAP_FDT_SIZE_MAX];
phys_addr_t efdt = fdt + MAX_FDT_SIZE;
diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
index 66d369870a74..e3544dd7871d 100644
--- a/include/linux/pgtable.h
+++ b/include/linux/pgtable.h
@@ -2075,7 +2075,7 @@ static inline unsigned long zero_pfn(unsigned long addr)
return zero_page_pfn;
}
-extern const uint8_t empty_zero_page[PAGE_SIZE];
+extern const uint8_t empty_zero_page[PAGE_SIZE_MAX];
extern struct page *__zero_page;
static inline struct page *_zero_page(unsigned long addr)
diff --git a/mm/mm_init.c b/mm/mm_init.c
index d99af80ec752..0abbe36f5667 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -62,7 +62,7 @@ unsigned long zero_page_pfn __ro_after_init;
EXPORT_SYMBOL(zero_page_pfn);
#ifndef __HAVE_COLOR_ZERO_PAGE
-const uint8_t empty_zero_page[PAGE_SIZE] __aligned(PAGE_SIZE);
+const uint8_t empty_zero_page[PAGE_SIZE_MAX] __aligned(PAGE_SIZE_MAX);
EXPORT_SYMBOL(empty_zero_page);
struct page *__zero_page __ro_after_init;
next prev parent reply other threads:[~2026-12-01 1:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 1:51 [RFC PATCH v2 00/43] Boot-time page size selection for arm64 (core) Eric Curtin
2026-12-01 1:51 ` [RFC PATCH v2 02/43] vmlinux.lds: Align page-aligned sections to PAGE_SIZE_MAX Eric Curtin
2026-12-01 1:51 ` [RFC PATCH v2 03/43] mm: page_frag: Use PAGE_SIZE_MIN/MAX limits in page_frag_cache Eric Curtin
2026-12-01 1:51 ` [RFC PATCH v2 04/43] mm: page_frag: Add _MIN/_MAX variants of PAGE_FRAG_CACHE_MAX_SIZE Eric Curtin
2026-12-01 1:51 ` [RFC PATCH v2 05/43] mm: Avoid split pmd ptl if pmd level is run-time folded Eric Curtin
2026-12-01 1:51 ` [RFC PATCH v2 06/43] mm/vmstat: Use THREAD_SIZE_MAX for the KSTACK_* counters Eric Curtin
2026-12-01 1:51 ` [RFC PATCH v2 07/43] fork: Permit boot-time THREAD_SIZE determination Eric Curtin
2026-12-01 1:51 ` [RFC PATCH v2 21/43] arm64: Test PAGE_SIZE instead of CONFIG_ARM64_*K_PAGES Eric Curtin
2026-12-01 1:51 ` Eric Curtin [this message]
2026-12-01 1:52 ` [RFC PATCH v2 30/43] arm64: Support runtime folding of the pmd level Eric Curtin
2026-12-01 1:52 ` [RFC PATCH v2 34/43] mm/damon/lru_sort: Initialise the stub access pattern at boot Eric Curtin
2026-12-01 1:52 ` [RFC PATCH v2 35/43] mm/zsmalloc: Size static limits for the worst-case page size Eric Curtin
2026-12-01 1:52 ` [RFC PATCH v2 38/43] mm: Use fixed sizes for shmem str_dup and swap cache PFN bits Eric Curtin
2026-12-01 1:52 ` [RFC PATCH v2 43/43] arm64: Enable boot-time page size selection Eric Curtin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201015240.1017259-26-ericcurtin17@gmail.com \
--to=ericcurtin17@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=david@kernel.org \
--cc=liam@infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=mark.rutland@arm.com \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=vbabka@kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox