Skip to content

Commit 32ac4c6

Browse files
author
Rafael Aquini
committed
x86/mm: further clarify switch_mm_irqs_off() documentation
JIRA: https://issues.redhat.com/browse/RHEL-84184 This patch is a backport of the following upstream commit: commit cd87d9f Author: Yosry Ahmed <yosryahmed@google.com> Date: Thu Feb 22 19:09:10 2024 +0000 x86/mm: further clarify switch_mm_irqs_off() documentation Commit accf6b23d1e5a ("x86/mm: clarify "prev" usage in switch_mm_irqs_off()") attempted to clarify x86's usage of the arguments passed by generic code, specifically the "prev" argument the is unused by x86. However, it could have done a better job with the comment above switch_mm_irqs_off(). Rewrite this comment according to Dave Hansen's suggestion. Link: https://lkml.kernel.org/r/20240222190911.1903054-1-yosryahmed@google.com Fixes: 3cfd662 ("x86/mm: clarify "prev" usage in switch_mm_irqs_off()") Signed-off-by: Yosry Ahmed <yosryahmed@google.com> Suggested-by: Dave Hansen <dave.hansen@intel.com> Acked-by: Dave Hansen <dave.hansen@intel.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov (AMD) <bp@alien8.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Rafael Aquini <raquini@redhat.com>
1 parent 6b6e0ee commit 32ac4c6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arch/x86/mm/tlb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,10 +494,10 @@ static inline void cr4_update_pce_mm(struct mm_struct *mm) { }
494494
#endif
495495

496496
/*
497-
* The "prev" argument passed by the caller does not always match CR3. For
498-
* example, the scheduler passes in active_mm when switching from lazy TLB mode
499-
* to normal mode, but switch_mm_irqs_off() can be called from x86 code without
500-
* updating active_mm. Use cpu_tlbstate.loaded_mm instead.
497+
* This optimizes when not actually switching mm's. Some architectures use the
498+
* 'unused' argument for this optimization, but x86 must use
499+
* 'cpu_tlbstate.loaded_mm' instead because it does not always keep
500+
* 'current->active_mm' up to date.
501501
*/
502502
void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next,
503503
struct task_struct *tsk)

0 commit comments

Comments
 (0)