Skip to content

Commit d4ae80f

Browse files
nizhenthmcgrof
authored andcommitted
sched: Move cfs_bandwidth_slice sysctls to fair.c
move cfs_bandwidth_slice sysctls to fair.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 3267e01 commit d4ae80f

3 files changed

Lines changed: 31 additions & 34 deletions

File tree

include/linux/sched/sysctl.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ extern int sysctl_numa_balancing_mode;
3131
#define sysctl_numa_balancing_mode 0
3232
#endif
3333

34-
#ifdef CONFIG_CFS_BANDWIDTH
35-
extern unsigned int sysctl_sched_cfs_bandwidth_slice;
36-
#endif
37-
3834
int sysctl_numa_balancing(struct ctl_table *table, int write, void *buffer,
3935
size_t *lenp, loff_t *ppos);
4036

kernel/sched/fair.c

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -109,25 +109,6 @@ static unsigned int sched_nr_latency = 8;
109109
* parent will (try to) run first.
110110
*/
111111
unsigned int sysctl_sched_child_runs_first __read_mostly;
112-
#ifdef CONFIG_SYSCTL
113-
static struct ctl_table sched_child_runs_first_sysctls[] = {
114-
{
115-
.procname = "sched_child_runs_first",
116-
.data = &sysctl_sched_child_runs_first,
117-
.maxlen = sizeof(unsigned int),
118-
.mode = 0644,
119-
.proc_handler = proc_dointvec,
120-
},
121-
{}
122-
};
123-
124-
static int __init sched_child_runs_first_sysctl_init(void)
125-
{
126-
register_sysctl_init("kernel", sched_child_runs_first_sysctls);
127-
return 0;
128-
}
129-
late_initcall(sched_child_runs_first_sysctl_init);
130-
#endif
131112

132113
/*
133114
* SCHED_OTHER wake-up granularity.
@@ -192,7 +173,37 @@ int __weak arch_asym_cpu_priority(int cpu)
192173
*
193174
* (default: 5 msec, units: microseconds)
194175
*/
195-
unsigned int sysctl_sched_cfs_bandwidth_slice = 5000UL;
176+
static unsigned int sysctl_sched_cfs_bandwidth_slice = 5000UL;
177+
#endif
178+
179+
#ifdef CONFIG_SYSCTL
180+
static struct ctl_table sched_fair_sysctls[] = {
181+
{
182+
.procname = "sched_child_runs_first",
183+
.data = &sysctl_sched_child_runs_first,
184+
.maxlen = sizeof(unsigned int),
185+
.mode = 0644,
186+
.proc_handler = proc_dointvec,
187+
},
188+
#ifdef CONFIG_CFS_BANDWIDTH
189+
{
190+
.procname = "sched_cfs_bandwidth_slice_us",
191+
.data = &sysctl_sched_cfs_bandwidth_slice,
192+
.maxlen = sizeof(unsigned int),
193+
.mode = 0644,
194+
.proc_handler = proc_dointvec_minmax,
195+
.extra1 = SYSCTL_ONE,
196+
},
197+
#endif
198+
{}
199+
};
200+
201+
static int __init sched_fair_sysctl_init(void)
202+
{
203+
register_sysctl_init("kernel", sched_fair_sysctls);
204+
return 0;
205+
}
206+
late_initcall(sched_fair_sysctl_init);
196207
#endif
197208

198209
static inline void update_load_add(struct load_weight *lw, unsigned long inc)

kernel/sysctl.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,16 +1681,6 @@ static struct ctl_table kern_table[] = {
16811681
.extra2 = SYSCTL_FOUR,
16821682
},
16831683
#endif /* CONFIG_NUMA_BALANCING */
1684-
#ifdef CONFIG_CFS_BANDWIDTH
1685-
{
1686-
.procname = "sched_cfs_bandwidth_slice_us",
1687-
.data = &sysctl_sched_cfs_bandwidth_slice,
1688-
.maxlen = sizeof(unsigned int),
1689-
.mode = 0644,
1690-
.proc_handler = proc_dointvec_minmax,
1691-
.extra1 = SYSCTL_ONE,
1692-
},
1693-
#endif
16941684
#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
16951685
{
16961686
.procname = "sched_energy_aware",

0 commit comments

Comments
 (0)