From: Alexander Gordeev <agordeev@linux.ibm.com>
To: Gerald Schaefer <gerald.schaefer@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
Kevin Brodsky <kevin.brodsky@arm.com>,
David Hildenbrand <david@redhat.com>
Subject: [PATCH v3 0/7] s390/mm: Batch PTE updates in lazy MMU mode
Date: Tue, 16 Jun 2026 14:40:32 +0200 [thread overview]
Message-ID: <cover.1781611976.git.agordeev@linux.ibm.com> (raw)
Hi All!
This is v3 of the batched PTE updates in lazy MMU mode rework.
The prereq patches 4,5 are in the mm tree and scheduled for -next already:
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
The presented implementation sets up per-cpu caches in the s390-specific
hotplug callbacks as opposed to CPUHP_BP_PREPARE_DYN hooks. I like this
approach better, since it locates the SMP-related lowcore initialization
in one place. But that is up for discussion.
Changes since v2:
- lazy_mmu_mode_enable_for_pte_range() renamed to lazy_mmu_mode_enable_with_ptes()
(David Hildenbrand)
- patch "mm/pgtable: Fix bogus comment to clear_not_present_full_ptes()"
is dropped (David Hildenbrand)
- direct PTE dereferencing KASAN sanitizer added (Heiko Carstens)
- CONFIG_IPTE_BATCH option is dropped (Heiko Carstens)
- PTE_POISON changed from zero to 0x800 (Heiko Carstens)
- allocate per-cpu caches on CPU hot-plug (Heiko Carstens)
- introduced a lowcore field for fast lazy mode checking (Heiko Carstens)
- few minor code changes (Heiko Carstens)
Changes since v1:
- lazy_mmu_mode_enable_pte() renamed to lazy_mmu_mode_enable_for_pte_range()
- lazy_mmu_mode_enable_for_pte_range() semantics clarified
- some sashiko comments addressed [1] including one bug fix
1. https://sashiko.dev/#/patchset/cover.1774420056.git.agordeev%40linux.ibm.com
- patches 2-4 added
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.
Alexander Gordeev (7):
mm: Make lazy MMU mode context-aware
s390/mm: Complete ptep_get() conversion
s390/mm: Batch PTE updates in lazy MMU mode
mm/gup: Cleanup pgtable entry accessors
mm/page_vma_mapped_walk: Use ptep_get_lockless() for lockless access
mm/kasan: Introduce helpers for lazy MMU mode sanitizer
s390/mm: Lazy MMU mode sanitizer
arch/s390/Kconfig | 1 +
arch/s390/boot/vmem.c | 32 +--
arch/s390/include/asm/hugetlb.h | 2 +-
arch/s390/include/asm/lazy_mmu.h | 9 +
arch/s390/include/asm/lowcore.h | 2 +-
arch/s390/include/asm/pgtable.h | 213 +++++++++++++---
arch/s390/kernel/setup.c | 2 +
arch/s390/kernel/smp.c | 7 +
arch/s390/mm/Makefile | 2 +-
arch/s390/mm/hugetlbpage.c | 12 +-
arch/s390/mm/lazy_mmu.c | 401 +++++++++++++++++++++++++++++++
arch/s390/mm/pageattr.c | 45 ++--
arch/s390/mm/pgtable.c | 8 +-
arch/s390/mm/vmem.c | 82 ++++---
fs/proc/task_mmu.c | 2 +-
include/linux/kasan.h | 16 ++
include/linux/pgtable.h | 46 ++++
mm/gup.c | 8 +-
mm/kasan/common.c | 10 +
mm/kasan/kasan.h | 2 +
mm/madvise.c | 8 +-
mm/memory.c | 8 +-
mm/mprotect.c | 2 +-
mm/mremap.c | 2 +-
mm/page_vma_mapped.c | 9 +-
mm/vmalloc.c | 6 +-
26 files changed, 805 insertions(+), 132 deletions(-)
create mode 100644 arch/s390/include/asm/lazy_mmu.h
create mode 100644 arch/s390/mm/lazy_mmu.c
--
2.53.0
next reply other threads:[~2026-06-16 12:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 12:40 Alexander Gordeev [this message]
2026-06-16 12:40 ` [PATCH v3 1/7] mm: Make lazy MMU mode context-aware Alexander Gordeev
2026-06-16 12:40 ` [PATCH v3 2/7] s390/mm: Complete ptep_get() conversion Alexander Gordeev
2026-06-16 12:40 ` [PATCH v3 3/7] s390/mm: Batch PTE updates in lazy MMU mode Alexander Gordeev
2026-06-16 12:40 ` [PATCH v3 4/7] mm/gup: Cleanup pgtable entry accessors Alexander Gordeev
2026-06-16 12:40 ` [PATCH v3 5/7] mm/page_vma_mapped_walk: Use ptep_get_lockless() for lockless access Alexander Gordeev
2026-06-16 12:40 ` [PATCH v3 6/7] mm/kasan: Introduce helpers for lazy MMU mode sanitizer Alexander Gordeev
2026-06-16 12:40 ` [PATCH v3 7/7] s390/mm: Lazy " Alexander Gordeev
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=cover.1781611976.git.agordeev@linux.ibm.com \
--to=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=david@redhat.com \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kevin.brodsky@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-s390@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.