[RFC PATCH 0/2] s390/mm: Batch PTE updates in lazy MMU mode
From: Alexander Gordeev
Date: Wed Mar 25 2026 - 03:43:14 EST
Hi All!
This series addresses an s390-specific aspect of how page table entries
are modified. In many cases, changing a valid PTE (for example, setting
or clearing a hardware bit) requires issuing an Invalidate Page Table
Entry (IPTE) instruction beforehand.
A disadvantage of the IPTE instruction is that it may initiate a
machine-wide quiesce state. This state acts as an expensive global
hardware lock and should be avoided whenever possible.
Currently, IPTE is invoked for each individual PTE update in most code
paths. However, the instruction itself supports invalidating multiple
PTEs at once, covering up to 256 entries. Using this capability can
significantly reduce the number of quiesce events, with a positive
impact on overall system performance. At present, this feature is not
utilized.
An effort was therefore made to identify kernel code paths that update
large numbers of consecutive PTEs. Such updates can be batched and
handled by a single IPTE invocation, leveraging the hardware support
described above.
A natural candidate for this optimization is page-table walkers that
change attributes of memory ranges and thus modify contiguous ranges
of PTEs. Many memory-management system calls enter lazy MMU mode while
updating such ranges.
This lazy MMU mode can be leveraged to build on the already existing
infrastructure and implement a software-level lazy MMU mechanism,
allowing expensive PTE invalidations on s390 to be batched.
Patch #2 is the actual s390 rework, while patch #1 is a prerequisite
that affects the generic code. It was briefly communicated upstream
and got some approvals:
https://lore.kernel.org/linux-mm/d407a381-099b-4ec6-a20e-aeff4f3d750f@xxxxxxx/#t
https://lore.kernel.org/linux-mm/852d6f8c-e167-4527-9dc9-98549124f6b1@xxxxxxxxxx/
I am sending this as an RFC in the hope that I may have missed less
obvious existing code paths or potential code changes that could
further enable batching. Any ideas would be greatly appreciated!
Thanks!
Alexander Gordeev (2):
mm: make lazy MMU mode context-aware
s390/mm: Batch PTE updates in lazy MMU mode
arch/s390/Kconfig | 8 +
arch/s390/include/asm/pgtable.h | 209 +++++++++++++++--
arch/s390/mm/Makefile | 1 +
arch/s390/mm/ipte_batch.c | 396 ++++++++++++++++++++++++++++++++
arch/s390/mm/pgtable.c | 8 +-
fs/proc/task_mmu.c | 2 +-
include/linux/pgtable.h | 42 ++++
mm/madvise.c | 8 +-
mm/memory.c | 8 +-
mm/mprotect.c | 2 +-
mm/mremap.c | 2 +-
mm/vmalloc.c | 6 +-
12 files changed, 659 insertions(+), 33 deletions(-)
create mode 100644 arch/s390/mm/ipte_batch.c
--
2.51.0