Skip to content

Commit f1b4f23

Browse files
committed
locking/rtmutex: Move max_lock_depth into rtmutex.c
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 <[email protected]>
1 parent d0d05f6 commit f1b4f23

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

include/linux/rtmutex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <linux/rbtree_types.h>
1919
#include <linux/spinlock_types_raw.h>
2020

21-
extern int max_lock_depth; /* for sysctl */
21+
extern int max_lock_depth;
2222

2323
struct rt_mutex_base {
2424
raw_spinlock_t wait_lock;

kernel/locking/rtmutex_api.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,24 @@
1313
*/
1414
int max_lock_depth = 1024;
1515

16+
static const struct ctl_table rtmutex_sysctl_table[] = {
17+
{
18+
.procname = "max_lock_depth",
19+
.data = &max_lock_depth,
20+
.maxlen = sizeof(int),
21+
.mode = 0644,
22+
.proc_handler = proc_dointvec,
23+
},
24+
};
25+
26+
static int __init init_rtmutex_sysctl(void)
27+
{
28+
register_sysctl_init("kernel", rtmutex_sysctl_table);
29+
return 0;
30+
}
31+
32+
subsys_initcall(init_rtmutex_sysctl);
33+
1634
/*
1735
* Debug aware fast / slowpath lock,trylock,unlock
1836
*

kernel/sysctl.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@
5959
#include <asm/nmi.h>
6060
#include <asm/io.h>
6161
#endif
62-
#ifdef CONFIG_RT_MUTEXES
63-
#include <linux/rtmutex.h>
64-
#endif
6562

6663
/* shared constants to be used in various sysctls */
6764
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[] = {
17091706
.proc_handler = proc_dointvec,
17101707
},
17111708
#endif
1712-
#ifdef CONFIG_RT_MUTEXES
1713-
{
1714-
.procname = "max_lock_depth",
1715-
.data = &max_lock_depth,
1716-
.maxlen = sizeof(int),
1717-
.mode = 0644,
1718-
.proc_handler = proc_dointvec,
1719-
},
1720-
#endif
17211709
#ifdef CONFIG_TREE_RCU
17221710
{
17231711
.procname = "panic_on_rcu_stall",

0 commit comments

Comments
 (0)