Skip to content

Commit 7e33001

Browse files
rikvanrielIngo Molnar
authored andcommitted
x86/mm/tlb: Put cpumask_test_cpu() check in switch_mm_irqs_off() under CONFIG_DEBUG_VM
On a web server workload, the cpumask_test_cpu() inside the WARN_ON_ONCE() in the 'prev == next branch' takes about 17% of all the CPU time of switch_mm_irqs_off(). On a large fleet, this WARN_ON_ONCE() has not fired in at least a month, possibly never. Move this test under CONFIG_DEBUG_VM so it does not get compiled in production kernels. Signed-off-by: Rik van Riel <riel@surriel.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/20241109003727.3958374-4-riel@surriel.com
1 parent abe949c commit 7e33001

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/mm/tlb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next,
568568
* mm_cpumask. The TLB shootdown code can figure out from
569569
* cpu_tlbstate_shared.is_lazy whether or not to send an IPI.
570570
*/
571-
if (WARN_ON_ONCE(prev != &init_mm &&
571+
if (IS_ENABLED(CONFIG_DEBUG_VM) && WARN_ON_ONCE(prev != &init_mm &&
572572
!cpumask_test_cpu(cpu, mm_cpumask(next))))
573573
cpumask_set_cpu(cpu, mm_cpumask(next));
574574

0 commit comments

Comments
 (0)