Re: [PATCH v2 1/6] mm: Make lazy MMU mode context-aware

Heiko Carstens
2026-04-23T10:49:23Z

On Wed, Apr 15, 2026 at 05:01:19PM +0200, Alexander Gordeev wrote:
> Lazy MMU mode is assumed to be context-independent, in the sense
> that it does not need any additional information while operating.
> However, the s390 architecture benefits from knowing the exact
> page table entries being modified.
>
> Introduce lazy_mmu_mode_enable_for_pte_range(), which is provided
> with the process address space and the page table being operated on.
> This information is required to enable s390-specific optimizations.
>
> The function takes parameters that are typically passed to page-
> table level walkers, which implies that the span of PTE entries
> never crosses a page table boundary.
>
> Architectures that do not require such information simply do not
> need to define the lazy_mmu_mode_enable_for_pte_range() callback.
>
> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
> ---
> fs/proc/task_mmu.c | 2 +-
> include/linux/pgtable.h | 47 +++++++++++++++++++++++++++++++++++++++++
> mm/madvise.c | 8 +++----
> mm/memory.c | 8 +++----
> mm/mprotect.c | 2 +-
> mm/mremap.c | 2 +-
> mm/vmalloc.c | 6 +++---
> 7 files changed, 61 insertions(+), 14 deletions(-)

...

> +/**
> + * lazy_mmu_mode_enable_for_pte_range() - Enable the lazy MMU mode with a speedup hint.
> + * @mm: Address space the pages are mapped into.
> + * @addr: Start address of the range.
> + * @end: End address of the range.
> + * @ptep: Page table pointer for the first entry.
> + *
> + * Enters a new lazy MMU mode section; if the mode was not already enabled,
> + * enables it and calls arch_enter_lazy_mmu_mode_for_pte_range().
> + *
> + * PTEs that fall within the specified range might observe update speedups.
> + * The PTE range must belong to the specified memory space and not cross

I guess it would be better use consistent terminology: "memory space"
should be changed to "address space" in order to avoid confusion.