]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
locking/rtmutex: Move max_lock_depth into rtmutex.c
authorJoel Granados <joel.granados@kernel.org>
Tue, 29 Apr 2025 13:12:17 +0000 (15:12 +0200)
committerJoel Granados <joel.granados@kernel.org>
Wed, 23 Jul 2025 09:52:47 +0000 (11:52 +0200)
Move the max_lock_depth sysctl table element into rtmutex_api.c. Removed
the rtmutex.h include from sysctl.c. Chose to move into rtmutex_api.c
to avoid multiple registrations every time rtmutex.c is included in other
files.

This is part of a greater effort to move ctl tables into their
respective subsystems which will reduce the merge conflicts in
kernel/sysctl.c.

Signed-off-by: Joel Granados <joel.granados@kernel.org>
include/linux/rtmutex.h
kernel/locking/rtmutex_api.c
kernel/sysctl.c

index 7d049883a08ace049384d70b4c97e3f4fb0e46f8..fa9f1021541eac3d56ff01a8b883c19052d0b3d2 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/rbtree_types.h>
 #include <linux/spinlock_types_raw.h>
 
-extern int max_lock_depth; /* for sysctl */
+extern int max_lock_depth;
 
 struct rt_mutex_base {
        raw_spinlock_t          wait_lock;
index 2d933528a0fa1dc546d91eb6c90ec34e4a4f1ca7..bafd5af98eaecc266d47bf1f3b424f7777bd2644 100644 (file)
  */
 int max_lock_depth = 1024;
 
+static const struct ctl_table rtmutex_sysctl_table[] = {
+       {
+               .procname       = "max_lock_depth",
+               .data           = &max_lock_depth,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec,
+       },
+};
+
+static int __init init_rtmutex_sysctl(void)
+{
+       register_sysctl_init("kernel", rtmutex_sysctl_table);
+       return 0;
+}
+
+subsys_initcall(init_rtmutex_sysctl);
+
 /*
  * Debug aware fast / slowpath lock,trylock,unlock
  *
index 473133d9651eac4ef44b8b63a44b77189818ac08..a22f35013da0d838ef421fc5d192f00d1e70fb0f 100644 (file)
@@ -59,9 +59,6 @@
 #include <asm/nmi.h>
 #include <asm/io.h>
 #endif
-#ifdef CONFIG_RT_MUTEXES
-#include <linux/rtmutex.h>
-#endif
 
 /* shared constants to be used in various sysctls */
 const int sysctl_vals[] = { 0, 1, 2, 3, 4, 100, 200, 1000, 3000, INT_MAX, 65535, -1 };
@@ -1709,15 +1706,6 @@ static const struct ctl_table kern_table[] = {
                .proc_handler   = proc_dointvec,
        },
 #endif
-#ifdef CONFIG_RT_MUTEXES
-       {
-               .procname       = "max_lock_depth",
-               .data           = &max_lock_depth,
-               .maxlen         = sizeof(int),
-               .mode           = 0644,
-               .proc_handler   = proc_dointvec,
-       },
-#endif
 #ifdef CONFIG_TREE_RCU
        {
                .procname       = "panic_on_rcu_stall",