From: Nicholas Piggin Date: Mon, 23 Aug 2021 23:59:19 +0000 (+1000) Subject: lazy-tlb-allow-lazy-tlb-mm-refcounting-to-be-configurable-fix-2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2b4ab2e7181a6be0a1348d4d9a57adec830a1723;p=users%2Fjedix%2Flinux-maple.git lazy-tlb-allow-lazy-tlb-mm-refcounting-to-be-configurable-fix-2 Explain the requirements for lazy tlb mm refcounting in the comment, to help with archs that may want to disable this by some means other than MMU_LAZY_TLB_SHOOTDOWN. Link: https://lkml.kernel.org/r/1623121605.j47gdpccep.astroid@bobo.none Signed-off-by: Nicholas Piggin Cc: Anton Blanchard Cc: Andy Lutomirski Cc: Randy Dunlap Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Signed-off-by: Andrew Morton Signed-off-by: Stephen Rothwell --- diff --git a/arch/Kconfig b/arch/Kconfig index 9dddd38d2bf4..16e7a3eddb66 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -426,6 +426,16 @@ config ARCH_WANT_IRQS_OFF_ACTIVATE_MM shootdowns should enable this. # Use normal mm refcounting for MMU_LAZY_TLB kernel thread references. +# MMU_LAZY_TLB_REFCOUNT=n can improve the scalability of context switching +# to/from kernel threads when the same mm is running on a lot of CPUs (a large +# multi-threaded application), by reducing contention on the mm refcount. +# +# This can be disabled if the architecture ensures no CPUs are using an mm as a +# "lazy tlb" beyond its final refcount (i.e., by the time __mmdrop frees the mm +# or its kernel page tables). This could be arranged by arch_exit_mmap(), or +# final exit(2) TLB flush, for example. arch code must also ensure the +# _lazy_tlb variants of mmgrab/mmdrop are used when dropping the lazy reference +# to a kthread ->active_mm (non-arch code has been converted already). config MMU_LAZY_TLB_REFCOUNT def_bool y