Skip to content

Commit f5ef06d

Browse files
nizhenthmcgrof
authored andcommitted
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>
1 parent a60707d commit f5ef06d

3 files changed

Lines changed: 21 additions & 14 deletions

File tree

include/linux/sched/sysctl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
6464
void *buffer, size_t *lenp, loff_t *ppos);
6565
int sysctl_numa_balancing(struct ctl_table *table, int write, void *buffer,
6666
size_t *lenp, loff_t *ppos);
67-
int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
68-
size_t *lenp, loff_t *ppos);
6967

7068
#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
7169
extern unsigned int sysctl_sched_energy_aware;

kernel/sched/core.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4430,7 +4430,7 @@ static int __init setup_schedstats(char *str)
44304430
__setup("schedstats=", setup_schedstats);
44314431

44324432
#ifdef CONFIG_PROC_SYSCTL
4433-
int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
4433+
static int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
44344434
size_t *lenp, loff_t *ppos)
44354435
{
44364436
struct ctl_table t;
@@ -4449,6 +4449,26 @@ int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
44494449
set_schedstats(state);
44504450
return err;
44514451
}
4452+
4453+
static struct ctl_table sched_schedstats_sysctls[] = {
4454+
{
4455+
.procname = "sched_schedstats",
4456+
.data = NULL,
4457+
.maxlen = sizeof(unsigned int),
4458+
.mode = 0644,
4459+
.proc_handler = sysctl_schedstats,
4460+
.extra1 = SYSCTL_ZERO,
4461+
.extra2 = SYSCTL_ONE,
4462+
},
4463+
{}
4464+
};
4465+
4466+
static int __init sched_schedstats_sysctl_init(void)
4467+
{
4468+
register_sysctl_init("kernel", sched_schedstats_sysctls);
4469+
return 0;
4470+
}
4471+
late_initcall(sched_schedstats_sysctl_init);
44524472
#endif /* CONFIG_PROC_SYSCTL */
44534473
#endif /* CONFIG_SCHEDSTATS */
44544474

kernel/sysctl.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,17 +1659,6 @@ int proc_do_static_key(struct ctl_table *table, int write,
16591659
}
16601660

16611661
static struct ctl_table kern_table[] = {
1662-
#ifdef CONFIG_SCHEDSTATS
1663-
{
1664-
.procname = "sched_schedstats",
1665-
.data = NULL,
1666-
.maxlen = sizeof(unsigned int),
1667-
.mode = 0644,
1668-
.proc_handler = sysctl_schedstats,
1669-
.extra1 = SYSCTL_ZERO,
1670-
.extra2 = SYSCTL_ONE,
1671-
},
1672-
#endif /* CONFIG_SCHEDSTATS */
16731662
#ifdef CONFIG_TASK_DELAY_ACCT
16741663
{
16751664
.procname = "task_delayacct",

0 commit comments

Comments
 (0)