Skip to content

Commit f79c9b8

Browse files
imtangmengmcgrof
authored andcommitted
kernel/lockdep: move lockdep sysctls to its own file
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty dishes, this makes it very difficult to maintain. To help with this maintenance let's start by moving sysctls to places where they actually belong. The proc sysctl maintainers do not want to know what sysctl knobs you wish to add for your own piece of code, we just care about the core logic. All filesystem syctls now get reviewed by fs folks. This commit follows the commit of fs, move the prove_locking and lock_stat sysctls to its own file, kernel/lockdep.c. Signed-off-by: tangmeng <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]>
1 parent aa779e5 commit f79c9b8

File tree

3 files changed

+33
-27
lines changed

3 files changed

+33
-27
lines changed

include/linux/lockdep.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616

1717
struct task_struct;
1818

19-
/* for sysctl */
20-
extern int prove_locking;
21-
extern int lock_stat;
22-
2319
#ifdef CONFIG_LOCKDEP
2420

2521
#include <linux/linkage.h>

kernel/locking/lockdep.c

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,50 @@
6464
#include <trace/events/lock.h>
6565

6666
#ifdef CONFIG_PROVE_LOCKING
67-
int prove_locking = 1;
67+
static int prove_locking = 1;
6868
module_param(prove_locking, int, 0644);
6969
#else
7070
#define prove_locking 0
7171
#endif
7272

7373
#ifdef CONFIG_LOCK_STAT
74-
int lock_stat = 1;
74+
static int lock_stat = 1;
7575
module_param(lock_stat, int, 0644);
7676
#else
7777
#define lock_stat 0
7878
#endif
7979

80+
#ifdef CONFIG_SYSCTL
81+
static struct ctl_table kern_lockdep_table[] = {
82+
#ifdef CONFIG_PROVE_LOCKING
83+
{
84+
.procname = "prove_locking",
85+
.data = &prove_locking,
86+
.maxlen = sizeof(int),
87+
.mode = 0644,
88+
.proc_handler = proc_dointvec,
89+
},
90+
#endif /* CONFIG_PROVE_LOCKING */
91+
#ifdef CONFIG_LOCK_STAT
92+
{
93+
.procname = "lock_stat",
94+
.data = &lock_stat,
95+
.maxlen = sizeof(int),
96+
.mode = 0644,
97+
.proc_handler = proc_dointvec,
98+
},
99+
#endif /* CONFIG_LOCK_STAT */
100+
{ }
101+
};
102+
103+
static __init int kernel_lockdep_sysctls_init(void)
104+
{
105+
register_sysctl_init("kernel", kern_lockdep_table);
106+
return 0;
107+
}
108+
late_initcall(kernel_lockdep_sysctls_init);
109+
#endif /* CONFIG_SYSCTL */
110+
80111
DEFINE_PER_CPU(unsigned int, lockdep_recursion);
81112
EXPORT_PER_CPU_SYMBOL_GPL(lockdep_recursion);
82113

kernel/sysctl.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@
8888
#ifdef CONFIG_RT_MUTEXES
8989
#include <linux/rtmutex.h>
9090
#endif
91-
#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
92-
#include <linux/lockdep.h>
93-
#endif
9491

9592
#if defined(CONFIG_SYSCTL)
9693

@@ -1679,24 +1676,6 @@ static struct ctl_table kern_table[] = {
16791676
.extra2 = SYSCTL_FOUR,
16801677
},
16811678
#endif /* CONFIG_NUMA_BALANCING */
1682-
#ifdef CONFIG_PROVE_LOCKING
1683-
{
1684-
.procname = "prove_locking",
1685-
.data = &prove_locking,
1686-
.maxlen = sizeof(int),
1687-
.mode = 0644,
1688-
.proc_handler = proc_dointvec,
1689-
},
1690-
#endif
1691-
#ifdef CONFIG_LOCK_STAT
1692-
{
1693-
.procname = "lock_stat",
1694-
.data = &lock_stat,
1695-
.maxlen = sizeof(int),
1696-
.mode = 0644,
1697-
.proc_handler = proc_dointvec,
1698-
},
1699-
#endif
17001679
{
17011680
.procname = "panic",
17021681
.data = &panic_timeout,

0 commit comments

Comments
 (0)