[PATCH v5 08/12] mm: enable lazy_mmu sections to nest
Alexander Gordeev
agordeev at linux.ibm.com
Thu Nov 27 23:33:04 AEDT 2025
On Mon, Nov 24, 2025 at 01:22:24PM +0000, Kevin Brodsky wrote:
Hi Kevin,
...
> +/**
> + * lazy_mmu_mode_pause() - Pause the lazy MMU mode.
> + *
> + * Pauses the lazy MMU mode; if it is currently active, disables it and calls
> + * arch_leave_lazy_mmu_mode().
> + *
> + * Must be paired with a call to lazy_mmu_mode_resume(). Calls to the
> + * lazy_mmu_mode_* API have no effect until the matching resume() call.
Sorry if it was discussed already - if yes, I somehow missed it. If I read
the whole thing correctly enter()/pause() interleaving is not forbidden?
lazy_mmu_mode_enable()
lazy_mmu_mode_pause()
lazy_mmu_mode_enable()
...
lazy_mmu_mode_disable()
lazy_mmu_mode_resume()
lazy_mmu_mode_disable()
> + *
> + * Has no effect if called:
> + * - While paused (inside another pause()/resume() pair)
> + * - In interrupt context
> + */
> static inline void lazy_mmu_mode_pause(void)
> {
> + struct lazy_mmu_state *state = ¤t->lazy_mmu_state;
> +
> if (in_interrupt())
> return;
>
> - arch_leave_lazy_mmu_mode();
> + VM_WARN_ON_ONCE(state->pause_count == U8_MAX);
> +
> + if (state->pause_count++ == 0 && state->enable_count > 0)
> + arch_leave_lazy_mmu_mode();
> }
>
> +/**
> + * lazy_mmu_mode_pause() - Resume the lazy MMU mode.
resume() ?
> + *
> + * Resumes the lazy MMU mode; if it was active at the point where the matching
> + * call to lazy_mmu_mode_pause() was made, re-enables it and calls
> + * arch_enter_lazy_mmu_mode().
> + *
> + * Must match a call to lazy_mmu_mode_pause().
> + *
> + * Has no effect if called:
> + * - While paused (inside another pause()/resume() pair)
> + * - In interrupt context
> + */
> static inline void lazy_mmu_mode_resume(void)
> {
> + struct lazy_mmu_state *state = ¤t->lazy_mmu_state;
> +
> if (in_interrupt())
> return;
>
> - arch_enter_lazy_mmu_mode();
> + VM_WARN_ON_ONCE(state->pause_count == 0);
> +
> + if (--state->pause_count == 0 && state->enable_count > 0)
> + arch_enter_lazy_mmu_mode();
> }
...
Thanks!
More information about the Linuxppc-dev
mailing list