[PATCH 00/17] s390/mm: Large kernel mappings for vmalloc and execmem ROX cache
From: Heiko Carstens
Date: Thu Dec 03 2026 - 05:34:02 EST
Enable the execmem ROX cache on s390. With EDAT1, module text, kprobes
and ftrace allocations are backed by 1MB read-only and executable
mappings instead of 4k mappings, which reduces TLB pressure.
The series consists of several parts:
Patches 1-4 are fixes and preparation, which are also useful on their
own: init_mm->asce_limit is initialized, the direct map page counters are
no longer modified for the kernel image, kernel page table changes are
serialized with the init_mm mmap lock instead of two unrelated mutexes,
and the vmem code uses the generic page table allocators.
Patches 5-7 add the page table dump WC attribute and implement
HAVE_ARCH_HUGE_VMAP and HAVE_ARCH_HUGE_VMALLOC, so that vmap(),
ioremap() and vmalloc() can use 1MB mappings.
Patches 8-13 rework pageattr.c: add helpers to replace live kernel page
table entries, use a common helper to change permissions on all page
table levels, avoid splitting mappings if the resulting entry would be
identical, mark intentional 4k mappings, and collapse split mappings back
into large pages after a successful set_memory_rox().
Patches 14-17 add PAGE_KERNEL_ROX, EXECMEM_KPROBES and EXECMEM_FTRACE
ranges (which makes the s390 specific alloc_insn_page() and the explicit
set_memory_rox() for ftrace trampolines obsolete), and finally enable
ARCH_HAS_EXECMEM_ROX.
Tested on s390 with EDAT1: all module text lives in two 1MB "PMD RO X"
mappings which stay intact across module load/unload and ftrace
selftests.
Series applies on top of linux-next 20261202.
Thanks,
Heiko
Heiko Carstens (17):
s390/boot: Initialize asce_limit for init_mm properly
s390/pageattr: Only account direct mapping in direct map page counters
s390/mm: Serialize kernel page table changes with init_mm mmap lock
s390/vmem: Use generic page table allocators for vmem page tables
s390/mm: Show write-combining attribute in page table dump
s390/mm: Implement HAVE_ARCH_HUGE_VMAP
s390/mm: Implement HAVE_ARCH_HUGE_VMALLOC
s390/pageattr: Add helpers to replace kernel page table entries
s390/mm: Add _SEGMENT_ENTRY_TYPE
s390/pageattr: Use common helper to change kernel page table permissions
s390/pageattr: Avoid splitting mappings if permissions do not change
s390/pageattr: Mark intentional 4k kernel mappings
s390/pageattr: Collapse kernel mappings after changing page attributes
s390/mm: Add PAGE_KERNEL_ROX
s390/execmem: Add EXECMEM_KPROBES range
s390/execmem: Add EXECMEM_FTRACE range
s390/execmem: Enable EXECMEM_ARCH_ROX
.../features/vm/huge-vmap/arch-support.txt | 2 +-
arch/s390/Kconfig | 3 +
arch/s390/boot/vmem.c | 1 +
arch/s390/include/asm/pgalloc.h | 2 +
arch/s390/include/asm/pgtable.h | 29 ++
arch/s390/include/asm/set_memory.h | 4 -
arch/s390/include/asm/vmalloc.h | 16 +
arch/s390/kernel/kprobes.c | 16 -
arch/s390/kernel/module.c | 11 +-
arch/s390/mm/dump_pagetables.c | 17 +-
arch/s390/mm/init.c | 45 +++
arch/s390/mm/pageattr.c | 336 +++++++++++++-----
arch/s390/mm/pgtable.c | 81 +++++
arch/s390/mm/vmem.c | 80 +++--
14 files changed, 484 insertions(+), 159 deletions(-)
base-commit: 799dd936553182df5770dde7f38d94c8337df75a
--
2.53.0