aboutsummaryrefslogtreecommitdiff
path: root/kernel/sched
diff options
context:
space:
mode:
authorZhen Ni2022-02-15 19:45:58 +0800
committerLuis Chamberlain2022-04-06 13:43:43 -0700
commitf5ef06d58be8311a9425e6a54a053ecb350952f3 (patch)
tree770eec66bcbbfe1ef7d8d6722bf7c9c8c23c2524 /kernel/sched
parenta60707d74bd1d119cf7bcc5101cda912fc46d5e3 (diff)
sched: Move schedstats sysctls to core.c
move schedstats sysctls to core.c and use the new register_sysctl_init() to register the sysctl interface. Signed-off-by: Zhen Ni <nizhen@uniontech.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/core.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d575b4914925..04440da5955f 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4430,7 +4430,7 @@ out:
__setup("schedstats=", setup_schedstats);
#ifdef CONFIG_PROC_SYSCTL
-int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
+static int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
size_t *lenp, loff_t *ppos)
{
struct ctl_table t;
@@ -4449,6 +4449,26 @@ int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
set_schedstats(state);
return err;
}
+
+static struct ctl_table sched_schedstats_sysctls[] = {
+ {
+ .procname = "sched_schedstats",
+ .data = NULL,
+ .maxlen = sizeof(unsigned int),
+ .mode = 0644,
+ .proc_handler = sysctl_schedstats,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_ONE,
+ },
+ {}
+};
+
+static int __init sched_schedstats_sysctl_init(void)
+{
+ register_sysctl_init("kernel", sched_schedstats_sysctls);
+ return 0;
+}
+late_initcall(sched_schedstats_sysctl_init);
#endif /* CONFIG_PROC_SYSCTL */
#endif /* CONFIG_SCHEDSTATS */