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
569 569
570#ifdef CONFIG_STACK_TRACER570#ifdef CONFIG_STACK_TRACER
571 571
572extern int stack_tracer_enabled;
573
574int stack_trace_sysctl(const struct ctl_table *table, int write, void *buffer,572int stack_trace_sysctl(const struct ctl_table *table, int write, void *buffer,
575 size_t *lenp, loff_t *ppos);573 size_t *lenp, loff_t *ppos);
576 574
kernel/sysctl.c+0−10
@@ -58,7 +58,6 @@ · 57 unmodified lines
58 58
59#ifdef CONFIG_X8659#ifdef CONFIG_X86
60#include <asm/nmi.h>60#include <asm/nmi.h>
61#include <asm/stacktrace.h>
62#include <asm/io.h>61#include <asm/io.h>
63#endif62#endif
64#ifdef CONFIG_SPARC63#ifdef CONFIG_SPARC
@@ -1652,15 +1651,6 @@ static const struct ctl_table kern_table[] = { · 1587 unmodified lines
1652 .proc_handler = proc_dointvec,1651 .proc_handler = proc_dointvec,
1653 },1652 },
1654#endif1653#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
1664#ifdef CONFIG_MODULES1654#ifdef CONFIG_MODULES
1665 {1655 {
1666 .procname = "modprobe",1656 .procname = "modprobe",
kernel/trace/trace_stack.c+21−1
@@ -32,7 +32,7 @@ static arch_spinlock_t stack_trace_max_lock = · 31 unmodified lines
32DEFINE_PER_CPU(int, disable_stack_tracer);32DEFINE_PER_CPU(int, disable_stack_tracer);
33static DEFINE_MUTEX(stack_sysctl_mutex);33static DEFINE_MUTEX(stack_sysctl_mutex);
34 34
35int stack_tracer_enabled;35static int stack_tracer_enabled;
36 36
37static void print_max_stack(void)37static void print_max_stack(void)
38{38{
@@ -578,3 +578,23 @@ static __init int stack_trace_init(void) · 539 unmodified lines
578}578}
579 579
580device_initcall(stack_trace_init);580device_initcall(stack_trace_init);
581
582
583static 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
593static int __init init_trace_stack_sysctls(void)
594{
595 register_sysctl_init("kernel", trace_stack_sysctl_table);
596 return 0;
597}
598subsys_initcall(init_trace_stack_sysctls);
599
600