]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
x86/mm: Opt-in to IRQs-off activate_mm()
authorAndy Lutomirski <luto@kernel.org>
Wed, 2 Apr 2025 09:45:40 +0000 (11:45 +0200)
committerIngo Molnar <mingo@kernel.org>
Sat, 12 Apr 2025 08:06:08 +0000 (10:06 +0200)
We gain nothing by having the core code enable IRQs right before calling
activate_mm() only for us to turn them right back off again in switch_mm().

This will save a few cycles, so execve() should be blazingly fast with this
patch applied!

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: https://lore.kernel.org/r/20250402094540.3586683-8-mingo@kernel.org
arch/x86/Kconfig
arch/x86/include/asm/mmu_context.h

index 4b9f378e05f6be9f0c90a722c4fba66ff96f073f..aeac63b11fc28e534830f13805c6baf6c55b7c05 100644 (file)
@@ -153,6 +153,7 @@ config X86
        select ARCH_WANT_HUGETLB_VMEMMAP_PREINIT if X86_64
        select ARCH_WANTS_THP_SWAP              if X86_64
        select ARCH_HAS_PARANOID_L1D_FLUSH
+       select ARCH_WANT_IRQS_OFF_ACTIVATE_MM
        select BUILDTIME_TABLE_SORT
        select CLKEVT_I8253
        select CLOCKSOURCE_WATCHDOG
index 988c1179263416aa4af114998c03706799931c74..c511f8584ae4b1b5c0325e410b0e217fe26c1b41 100644 (file)
@@ -190,7 +190,7 @@ extern void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next,
 #define activate_mm(prev, next)                        \
 do {                                           \
        paravirt_enter_mmap(next);              \
-       switch_mm((prev), (next), NULL);        \
+       switch_mm_irqs_off((prev), (next), NULL);       \
 } while (0);
 
 #ifdef CONFIG_X86_32