[PATCH 1/4] locking/osq_lock: The Kconfig for dynamic numa-aware osq lock.

From: yongli-oc
Date: Sat Sep 14 2024 - 05:21:04 EST


The make menu to choose if compile the dynamic numa-aware osq lock
or not, default is N.

Signed-off-by: yongli-oc <yongli-oc@xxxxxxxxxxx>
---
kernel/Kconfig.numalocks | 17 +++++++++++++++++
lib/Kconfig.debug | 2 ++
2 files changed, 19 insertions(+)
create mode 100644 kernel/Kconfig.numalocks

diff --git a/kernel/Kconfig.numalocks b/kernel/Kconfig.numalocks
new file mode 100644
index 000000000000..feb1751b637c
--- /dev/null
+++ b/kernel/Kconfig.numalocks
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+menu "NUMA Lock Supporting (OSQ)"
+
+config LOCK_SPIN_ON_OWNER_NUMA
+ bool "Enable dynamic numa-aware osq lock"
+ depends on LOCK_SPIN_ON_OWNER && X86_64
+ default n
+ help
+ According the cpu numa architecture, the numa-aware lock
+ always unlocks the process waiting on the same numa node
+ first. It is different from the kernel inbox osq_lock.
+ The dynamic numa-aware osq lock switchies between osq_lock and
+ numa-aware lock automatically, according contention level.
+ Enable: echo 1 > /proc/zx_numa_lock/dynamic_enable.
+
+endmenu # NUMA Lock Supporting
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 27539c2626bf..eb2314d47420 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1337,6 +1337,8 @@ config DEBUG_PREEMPT
depending on workload as it triggers debugging routines for each
this_cpu operation. It should only be used for debugging purposes.

+source "kernel/Kconfig.numalocks"
+
menu "Lock Debugging (spinlocks, mutexes, etc...)"

config LOCK_DEBUGGING_SUPPORT
--
2.34.1