Skip to content

Commit a60707d

Browse files
nizhenthmcgrof
authored andcommitted
sched: Move child_runs_first sysctls to fair.c
move child_runs_first 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 3123109 commit a60707d

4 files changed

Lines changed: 21 additions & 9 deletions

File tree

include/linux/sched/sysctl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ extern unsigned long sysctl_hung_task_timeout_secs;
1414
enum { sysctl_hung_task_timeout_secs = 0 };
1515
#endif
1616

17-
extern unsigned int sysctl_sched_child_runs_first;
18-
1917
enum sched_tunable_scaling {
2018
SCHED_TUNABLESCALING_NONE,
2119
SCHED_TUNABLESCALING_LOG,

kernel/sched/fair.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,25 @@ 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
112131

113132
/*
114133
* SCHED_OTHER wake-up granularity.

kernel/sched/sched.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ extern __read_mostly int scheduler_running;
108108
extern unsigned long calc_load_update;
109109
extern atomic_long_t calc_load_tasks;
110110

111+
extern unsigned int sysctl_sched_child_runs_first;
112+
111113
extern void calc_global_load_tick(struct rq *this_rq);
112114
extern long calc_load_fold_active(struct rq *this_rq, long adjust);
113115

kernel/sysctl.c

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

16611661
static struct ctl_table kern_table[] = {
1662-
{
1663-
.procname = "sched_child_runs_first",
1664-
.data = &sysctl_sched_child_runs_first,
1665-
.maxlen = sizeof(unsigned int),
1666-
.mode = 0644,
1667-
.proc_handler = proc_dointvec,
1668-
},
16691662
#ifdef CONFIG_SCHEDSTATS
16701663
{
16711664
.procname = "sched_schedstats",

0 commit comments

Comments
 (0)