Skip to content

Commit 8e4e83b

Browse files
Wei Xiaomcgrof
authored andcommitted
ftrace: move sysctl_ftrace_enabled to ftrace.c
This moves ftrace_enabled to trace/ftrace.c. We move sysctls to places where features actually belong to improve the readability of the code and reduce the risk of code merge conflicts. At the same time, the proc-sysctl maintainers do not want to know what sysctl knobs you wish to add for your owner piece of code, we just care about the core logic. Signed-off-by: Wei Xiao <[email protected]> Acked-by: Steven Rostedt (Google) <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]>
1 parent d772cc2 commit 8e4e83b

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

include/linux/ftrace.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ static inline int ftrace_mod_get_kallsym(unsigned int symnum, unsigned long *val
101101
#ifdef CONFIG_FUNCTION_TRACER
102102

103103
extern int ftrace_enabled;
104-
extern int
105-
ftrace_enable_sysctl(struct ctl_table *table, int write,
106-
void *buffer, size_t *lenp, loff_t *ppos);
107104

108105
#ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
109106

kernel/sysctl.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,15 +1751,6 @@ static struct ctl_table kern_table[] = {
17511751
.proc_handler = proc_dointvec,
17521752
},
17531753
#endif
1754-
#ifdef CONFIG_FUNCTION_TRACER
1755-
{
1756-
.procname = "ftrace_enabled",
1757-
.data = &ftrace_enabled,
1758-
.maxlen = sizeof(int),
1759-
.mode = 0644,
1760-
.proc_handler = ftrace_enable_sysctl,
1761-
},
1762-
#endif
17631754
#ifdef CONFIG_STACK_TRACER
17641755
{
17651756
.procname = "stack_tracer_enabled",

kernel/trace/ftrace.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7921,7 +7921,8 @@ static bool is_permanent_ops_registered(void)
79217921
return false;
79227922
}
79237923

7924-
int
7924+
#ifdef CONFIG_SYSCTL
7925+
static int
79257926
ftrace_enable_sysctl(struct ctl_table *table, int write,
79267927
void *buffer, size_t *lenp, loff_t *ppos)
79277928
{
@@ -7964,3 +7965,22 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
79647965
mutex_unlock(&ftrace_lock);
79657966
return ret;
79667967
}
7968+
7969+
static struct ctl_table ftrace_sysctls[] = {
7970+
{
7971+
.procname = "ftrace_enabled",
7972+
.data = &ftrace_enabled,
7973+
.maxlen = sizeof(int),
7974+
.mode = 0644,
7975+
.proc_handler = ftrace_enable_sysctl,
7976+
},
7977+
{}
7978+
};
7979+
7980+
static int __init ftrace_sysctl_init(void)
7981+
{
7982+
register_sysctl_init("kernel", ftrace_sysctls);
7983+
return 0;
7984+
}
7985+
late_initcall(ftrace_sysctl_init);
7986+
#endif

0 commit comments

Comments
 (0)