History

stack_tracer: move sysctl registration to kernel/trace/trace_stack.c

Move stack_tracer_enabled into trace_stack_sysctl_table. 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.

Joel Granados committed 1 year ago

Commit 67049b51 parent dd293df3 files · +21 −13Browse files

Unified · Split

3 files
  1. include/linux/ftrace.h +0 −2
  2. kernel/sysctl.c +0 −10
  3. kernel/trace/trace_stack.c +21 −1
include/linux/ftrace.h+0−2
@@ -569,8 +569,6 @@ static inline void arch_ftrace_set_direct_caller(struct ftrace_regs *fregs, · 568 unmodified lines
569569
570570 #ifdef CONFIG_STACK_TRACER
571571
572−extern int stack_tracer_enabled;
573−
574572 int stack_trace_sysctl(const struct ctl_table *table, int write, void *buffer,
575573 size_t *lenp, loff_t *ppos);
576574
kernel/sysctl.c+0−10
@@ -58,7 +58,6 @@ · 57 unmodified lines
5858
5959 #ifdef CONFIG_X86
6060 #include <asm/nmi.h>
61−#include <asm/stacktrace.h>
6261 #include <asm/io.h>
6362 #endif
6463 #ifdef CONFIG_SPARC
@@ -1652,15 +1651,6 @@ static const struct ctl_table kern_table[] = { · 1587 unmodified lines
16521651 .proc_handler = proc_dointvec,
16531652 },
16541653 #endif
1655−#ifdef CONFIG_STACK_TRACER
1656− {
1657− .procname = "stack_tracer_enabled",
1658− .data = &stack_tracer_enabled,
1659− .maxlen = sizeof(int),
1660− .mode = 0644,
1661− .proc_handler = stack_trace_sysctl,
1662− },
1663−#endif
16641654 #ifdef CONFIG_MODULES
16651655 {
16661656 .procname = "modprobe",
kernel/trace/trace_stack.c+21−1
@@ -32,7 +32,7 @@ static arch_spinlock_t stack_trace_max_lock = · 31 unmodified lines
3232 DEFINE_PER_CPU(int, disable_stack_tracer);
3333 static DEFINE_MUTEX(stack_sysctl_mutex);
3434
35−int stack_tracer_enabled;
35+static int stack_tracer_enabled;
3636
3737 static void print_max_stack(void)
3838 {
@@ -578,3 +578,23 @@ static __init int stack_trace_init(void) · 539 unmodified lines
578578 }
579579
580580 device_initcall(stack_trace_init);
581+
582+
583+static const struct ctl_table trace_stack_sysctl_table[] = {
584+ {
585+ .procname = "stack_tracer_enabled",
586+ .data = &stack_tracer_enabled,
587+ .maxlen = sizeof(int),
588+ .mode = 0644,
589+ .proc_handler = stack_trace_sysctl,
590+ },
591+};
592+
593+static int __init init_trace_stack_sysctls(void)
594+{
595+ register_sysctl_init("kernel", trace_stack_sysctl_table);
596+ return 0;
597+}
598+subsys_initcall(init_trace_stack_sysctls);
599+
600+