Skip to content

Commit b1d1779

Browse files
RichardWeiYangPeter Zijlstra
authored andcommitted
sched/core: Simplify sched_init()
Currently root_task_group.shares and cfs_bandwidth are initialized for each online cpu, which not necessary. Let's take it out to do it only once. Signed-off-by: Wei Yang <richard.weiyang@gmail.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20200423214443.29994-1-richard.weiyang@gmail.com
1 parent 12ac678 commit b1d1779

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/sched/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6597,6 +6597,8 @@ void __init sched_init(void)
65976597
root_task_group.cfs_rq = (struct cfs_rq **)ptr;
65986598
ptr += nr_cpu_ids * sizeof(void **);
65996599

6600+
root_task_group.shares = ROOT_TASK_GROUP_LOAD;
6601+
init_cfs_bandwidth(&root_task_group.cfs_bandwidth);
66006602
#endif /* CONFIG_FAIR_GROUP_SCHED */
66016603
#ifdef CONFIG_RT_GROUP_SCHED
66026604
root_task_group.rt_se = (struct sched_rt_entity **)ptr;
@@ -6649,7 +6651,6 @@ void __init sched_init(void)
66496651
init_rt_rq(&rq->rt);
66506652
init_dl_rq(&rq->dl);
66516653
#ifdef CONFIG_FAIR_GROUP_SCHED
6652-
root_task_group.shares = ROOT_TASK_GROUP_LOAD;
66536654
INIT_LIST_HEAD(&rq->leaf_cfs_rq_list);
66546655
rq->tmp_alone_branch = &rq->leaf_cfs_rq_list;
66556656
/*
@@ -6671,7 +6672,6 @@ void __init sched_init(void)
66716672
* We achieve this by letting root_task_group's tasks sit
66726673
* directly in rq->cfs (i.e root_task_group->se[] = NULL).
66736674
*/
6674-
init_cfs_bandwidth(&root_task_group.cfs_bandwidth);
66756675
init_tg_cfs_entry(&root_task_group, &rq->cfs, NULL, i, NULL);
66766676
#endif /* CONFIG_FAIR_GROUP_SCHED */
66776677

0 commit comments

Comments
 (0)