* [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64
@ 2026-12-02 3:15 Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 21/22] coredump: Use PAGE_SIZE_MIN for the zero-fill buffer Eric Curtin
0 siblings, 1 reply; 3+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Eric Curtin, Ryan Roberts, ceph-devel, ecryptfs, fuse-devel, gfs2,
linux-afs, linux-arm-kernel, linux-btrfs, linux-erofs, linux-ext4,
linux-fsdevel, linux-mm, linux-nfs
From: Eric Curtin <eric.curtin@docker.com>
This series is part of the boot-time page size selection work for arm64,
posted as RFC [1]. With CONFIG_ARM64_BOOT_TIME_PAGE_SIZE=y, PAGE_SIZE,
PAGE_SHIFT and PAGE_MASK are variables chosen at boot with arm64.pagesize=,
so code that needs a compile-time constant (array sizes, struct layouts,
static initialisers, BUILD_BUG_ON(), case labels, #if) has to use the new
PAGE_SIZE_MIN/PAGE_SIZE_MAX limits or a run-time value instead. For fixed
page sizes both limits equal PAGE_SIZE, so behaviour should not change.
The patches here convert filesystems. They apply on top of the core series
[1], whose patch 1 adds PAGE_SIZE_MIN/MAX, and are otherwise independent
of each other. Patches authored by Ryan Roberts come from his v1 [2],
updated for v7.4-rc5. The full tree is at:
https://github.com/ericcurtin/linux/tree/boot-time-page-size-v2
Testing: allmodconfig with the option enabled builds cleanly on arm64
with all of these applied, and the defconfig kernel boots to userspace
with 4K, 16K and 64K pages under QEMU/KVM (details in [1]). The code in
this series is not otherwise exercised on hardware.
Tool use: these conversions were prepared with an LLM coding assistant
(opencode with Claude Sonnet), driven by build errors and followed by an
automated review pass. I have not hand-audited every patch, so please
review with that in mind and tell me where you would prefer a different
approach for your subsystem.
[1] https://lore.kernel.org/all/20261201015240.1017259-1-ericcurtin17@gmail.com/
[2] https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@arm.com/
Eric Curtin (17):
smb: client: Use PAGE_SIZE_MIN in the lock element build checks
fs/resctrl: Define the kernfs_ops as page-size variables
ocfs2: Use PAGE_SIZE_MIN/MAX for the page-count limits
ntfs3: Use MAX_BUF_PER_PAGE_SIZE_MAX for struct ntfs_buffers
ntfs: Use PAGE_SIZE_MIN in NTFS_WOF_MAX_PAGES
nilfs2: Test PAGE_SIZE at run time in the rec_len conversions
jfs: Use PAGE_SIZE_MAX to size the metapage anchor arrays
isofs: Use PAGE_SIZE_MAX for zisofs_sink_page
ext4: Use PAGE_SIZE_MAX for the inline KUnit test data buffer
ext2: Test PAGE_SIZE at run time in the rec_len conversions
erofs: Make the decompressor bounce buffers flexible arrays
ecryptfs: Resolve the PAGE_SIZE cache sizes at cache creation time
dlm: Use PAGE_SIZE_MIN in the lowcomms buffer size build check
cramfs: Allocate the read buffers at init time
ceph: Use PAGE_SHIFT_MIN in the ceph_fscrypt_blocks() build check
btrfs: Use PAGE_SIZE_MAX in a static_assert and min_t() for PAGE_SHIFT
afs: Use PAGE_SIZE_MAX to size struct afs_xdr_dir_page
Ryan Roberts (5):
fuse: Check CUSE and ioctl buffer sizes against PAGE_SIZE_MIN
btrfs: Use PAGE_SIZE_MAX and PAGE_SIZE_MIN for compile-time checks
NFSv4: Use PAGE_SIZE_MIN to size ACL and xattr page arrays
coredump: Use PAGE_SIZE_MIN for the zero-fill buffer
fat: Use MAX_BUF_PER_PAGE_SIZE_MAX to size buffer_head arrays
^ permalink raw reply [flat|nested] 3+ messages in thread
* [RFC PATCH v2 21/22] coredump: Use PAGE_SIZE_MIN for the zero-fill buffer
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-03 3:16 ` sashiko-bot
0 siblings, 1 reply; 3+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Ryan Roberts, Alexander Viro, Christian Brauner, Jan Kara,
Kees Cook, linux-fsdevel, linux-mm
From: Ryan Roberts <ryan.roberts@arm.com>
With boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot size the static zeroes[] buffer in
__dump_skip(), and some fs code must be reworked as well.
In __dump_skip(), size zeroes[] and the chunk length with
PAGE_SIZE_MIN. This is the old PAGE_SIZE when the page size is fixed;
PAGE_SIZE_MIN is preferred over PAGE_SIZE_MAX to save memory.
In binfmt_elf, turn the #if choosing ELF_MIN_ALIGN into a ternary
expression that evaluates at run time, and define elf_format with
DEFINE_GLOBAL_PAGE_SIZE_VAR() so that its ELF_EXEC_PAGESIZE based
initialiser can be deferred to boot.
No functional change for compile-time page sizes.
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/binfmt_elf.c | 11 ++++-------
fs/coredump.c | 4 ++--
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index bf7f8f47548d..9adec104a211 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -79,11 +79,8 @@ static bool elf_core_dump(struct coredump_params *cprm);
#define elf_core_dump NULL
#endif
-#if ELF_EXEC_PAGESIZE > PAGE_SIZE
-#define ELF_MIN_ALIGN ELF_EXEC_PAGESIZE
-#else
-#define ELF_MIN_ALIGN PAGE_SIZE
-#endif
+#define ELF_MIN_ALIGN \
+ (ELF_EXEC_PAGESIZE > PAGE_SIZE ? ELF_EXEC_PAGESIZE : PAGE_SIZE)
#ifndef ELF_CORE_EFLAGS
#define ELF_CORE_EFLAGS 0
@@ -93,14 +90,14 @@ static bool elf_core_dump(struct coredump_params *cprm);
#define ELF_PAGEOFFSET(_v) ((_v) & (ELF_MIN_ALIGN-1))
#define ELF_PAGEALIGN(_v) (((_v) + ELF_MIN_ALIGN - 1) & ~(ELF_MIN_ALIGN - 1))
-static struct linux_binfmt elf_format = {
+static DEFINE_GLOBAL_PAGE_SIZE_VAR(struct linux_binfmt, elf_format, {
.module = THIS_MODULE,
.load_binary = load_elf_binary,
#ifdef CONFIG_COREDUMP
.core_dump = elf_core_dump,
.min_coredump = ELF_EXEC_PAGESIZE,
#endif
-};
+});
#define BAD_ADDR(x) (unlikely((unsigned long)(x) >= TASK_SIZE))
diff --git a/fs/coredump.c b/fs/coredump.c
index 82ef9d115999..e9658771c217 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -1442,7 +1442,7 @@ static void dump_end_record(struct coredump_params *cprm)
static bool __dump_skip(struct coredump_params *cprm, size_t nr)
{
- static char zeroes[PAGE_SIZE];
+ static char zeroes[PAGE_SIZE_MIN];
struct file *file = cprm->file;
if (dump_sparse(cprm)) {
@@ -1460,7 +1460,7 @@ static bool __dump_skip(struct coredump_params *cprm, size_t nr)
}
while (nr) {
- size_t chunk = min_t(size_t, nr, PAGE_SIZE);
+ size_t chunk = min_t(size_t, nr, PAGE_SIZE_MIN);
if (!__dump_emit(cprm, zeroes, chunk))
return false;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH v2 21/22] coredump: Use PAGE_SIZE_MIN for the zero-fill buffer
2026-12-02 3:15 ` [RFC PATCH v2 21/22] coredump: Use PAGE_SIZE_MIN for the zero-fill buffer Eric Curtin
@ 2026-12-03 3:16 ` sashiko-bot
0 siblings, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-12-03 3:16 UTC (permalink / raw)
To: Eric Curtin
Cc: Ryan Roberts, Alexander Viro, Christian Brauner, Jan Kara,
Kees Cook, linux-mm
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] coredump: undeclared PAGE_SIZE_MIN and
DEFINE_GLOBAL_PAGE_SIZE_VAR break build
--
commit 814f39fe7ab34dd716c7efe55a610f159148a21b
Author: Ryan Roberts <ryan.roberts@arm.com>
coredump: Use PAGE_SIZE_MIN for the zero-fill buffer
This commit reworks ELF_MIN_ALIGN, elf_format, and the __dump_skip()
zero-fill buffer to avoid relying on PAGE_SIZE as a compile-time constant.
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index bf7f8f47548d3..9adec104a2113 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
[ ... ]
> @@ -93,14 +90,14 @@ static bool elf_core_dump(struct coredump_params *cprm);
> #define ELF_PAGEOFFSET(_v) ((_v) & (ELF_MIN_ALIGN-1))
> #define ELF_PAGEALIGN(_v) (((_v) + ELF_MIN_ALIGN - 1) & ~(ELF_MIN_ALIGN - 1))
>
> -static struct linux_binfmt elf_format = {
> +static DEFINE_GLOBAL_PAGE_SIZE_VAR(struct linux_binfmt, elf_format, {
> .module = THIS_MODULE,
> .load_binary = load_elf_binary,
> #ifdef CONFIG_COREDUMP
> .core_dump = elf_core_dump,
> .min_coredump = ELF_EXEC_PAGESIZE,
> #endif
> -};
> +});
>
> #define BAD_ADDR(x) (unlikely((unsigned long)(x) >= TASK_SIZE))
>
> diff --git a/fs/coredump.c b/fs/coredump.c
> index 82ef9d115999a..e9658771c2173 100644
> --- a/fs/coredump.c
> +++ b/fs/coredump.c
> @@ -1442,7 +1442,7 @@ static void dump_end_record(struct coredump_params *cprm)
>
> static bool __dump_skip(struct coredump_params *cprm, size_t nr)
> {
> - static char zeroes[PAGE_SIZE];
> + static char zeroes[PAGE_SIZE_MIN];
> struct file *file = cprm->file;
>
> if (dump_sparse(cprm)) {
> @@ -1460,7 +1460,7 @@ static bool __dump_skip(struct coredump_params *cprm, size_t nr)
> }
>
> while (nr) {
> - size_t chunk = min_t(size_t, nr, PAGE_SIZE);
> + size_t chunk = min_t(size_t, nr, PAGE_SIZE_MIN);
>
> if (!__dump_emit(cprm, zeroes, chunk))
> return false;
[Severity: High]
Are the definitions for DEFINE_GLOBAL_PAGE_SIZE_VAR and PAGE_SIZE_MIN
missing from this tree? Neither symbol is defined in include/vdso/page.h
or any other header, so fs/binfmt_elf.c, fs/compat_binfmt_elf.c, and
fs/coredump.c fail to compile.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202031533.1665444-1-ericcurtin17@gmail.com?part=21
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-12-03 3:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 21/22] coredump: Use PAGE_SIZE_MIN for the zero-fill buffer Eric Curtin
2026-12-03 3:16 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox