hulk inclusion category: feature bugzilla: 169576 https://gitee.com/openeuler/kernel/issues/I7LEG5
--------------------------------
Enabling CNA is controlled via a new configuration option (NUMA_AWARE_SPINLOCKS). Add it for arm64.
Signed-off-by: Wei Li liwei391@huawei.com --- arch/arm64/Kconfig | 16 ++++++++++++++++ arch/x86/kernel/alternative.c | 4 ---- mm/mempolicy.c | 4 ++++ 3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 343e1e1cae10..a302c82c182b 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1400,6 +1400,22 @@ config NODES_SHIFT Specify the maximum number of NUMA Nodes available on the target system. Increases memory reserved to accommodate various tables.
+config NUMA_AWARE_SPINLOCKS + bool "Numa-aware spinlocks" + depends on NUMA + depends on QUEUED_SPINLOCKS + depends on PARAVIRT_SPINLOCKS + default y + help + Introduce NUMA (Non Uniform Memory Access) awareness into + the slow path of spinlocks. + + In this variant of qspinlock, the kernel will try to keep the lock + on the same node, thus reducing the number of remote cache misses, + while trading some of the short term fairness for better performance. + + Say N if you want absolute first come first serve fairness. + source "kernel/Kconfig.hz"
config ARCH_SPARSEMEM_ENABLE diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 4074238e6a37..f615e0cb6d93 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -1371,10 +1371,6 @@ void __init alternative_instructions(void) */ paravirt_set_cap();
-#if defined(CONFIG_NUMA_AWARE_SPINLOCKS) - cna_configure_spin_lock_slowpath(); -#endif - /* * First patch paravirt functions, such that we overwrite the indirect * call with the direct call. diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 1756389a0609..40985c9d92d0 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -2944,6 +2944,10 @@ void __init numa_policy_init(void) pr_err("%s: interleaving failed\n", __func__);
check_numabalancing_enable(); + +#if defined(CONFIG_NUMA_AWARE_SPINLOCKS) + cna_configure_spin_lock_slowpath(); +#endif }
/* Reset policy of current process to default */