Re: [PATCH v4 07/12] mm: enable lazy_mmu sections to nest
From: Kevin Brodsky <hidden>
Date: 2025-11-03 18:08:56
Also in:
linux-arm-kernel, linux-mm, lkml, sparclinux, xen-devel
From: Kevin Brodsky <hidden>
Date: 2025-11-03 18:08:56
Also in:
linux-arm-kernel, linux-mm, lkml, sparclinux, xen-devel
On 01/11/2025 12:22, David Hildenbrand wrote:
quoted
static inline void lazy_mmu_mode_pause(void) { + struct lazy_mmu_state *state = ¤t->lazy_mmu_state; + + VM_WARN_ON(state->nesting_level == 0 || !state->active); + + state->active = false; arch_leave_lazy_mmu_mode();Just one question: Don't we want to allow for pause/resume when not enabled? Would seem valid to me, because pause/resume code should actually not worry about that, right?
This does sound sensible, thanks for the suggestion. The initial goal was to allow functions that know they're called with lazy MMU enabled to be able to pause it temporarily if they need batching disabled. But we could generalise this to: if you know batching would break things, then you can preemptively add a pause/resume pair, and it won't do anything unless you're called with lazy MMU enabled. I also like this as this removes an invalid usage situation - now as long as you have balanced enable/disable and pause/resume calls, you're good. Will make that change in v5. - Kevin
if (!state->nesting_level) {
VM_WARN_ON(state->active);
return;
}
VM_WARN_ON(!state->active);
state->active = false;
arch_leave_lazy_mmu_mode();