Thread (80 messages) 80 messages, 8 authors, 2025-11-24

Re: [PATCH v4 11/12] x86/xen: use lazy_mmu_state when context-switching

From: Kevin Brodsky <hidden>
Date: 2025-11-03 18:29:11
Also in: linux-arm-kernel, linux-mm, lkml, sparclinux, xen-devel

On 03/11/2025 16:15, David Hildenbrand (Red Hat) wrote:
On 29.10.25 11:09, Kevin Brodsky wrote:
quoted
[...]
@@ -437,7 +436,7 @@ static void xen_end_context_switch(struct
task_struct *next)
        xen_mc_flush();
      leave_lazy(XEN_LAZY_CPU);
-    if (test_and_clear_ti_thread_flag(task_thread_info(next),
TIF_LAZY_MMU_UPDATES))
+    if (next->lazy_mmu_state.active)
This is nasty. If in_lazy_mmu_mode() is not sufficient, we will want
to have a separate helper that makes it clear what the difference
between both variants is.
in_lazy_mmu_mode() operates on current, but here we're operating on a
different task. The difference is more fundamental than just passing a
task_struct * or not: in_lazy_mmu_mode() is about whether we're
currently in lazy MMU mode, i.e. not paused and not in interrupt
context. A task that isn't scheduled is never in lazy MMU mode -
lazy_mmu_state.active is just the saved state to be restored when
scheduled again.

My point here is that we could have a helper for this use-case, but it
should not be used in other situations (at least not on current). Maybe
__task_lazy_mmu_active(task)? I do wonder if accessing lazy_mmu_state
directly isn't expressing the intention well enough though (checking the
saved state).

- Kevin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help