Skip to contentSkip to conversation

sched: Proper initialization of root_task_group

PATCH In review Heechul Yun 3 participants 3 messages Nov 30, 2011 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: Proper initialization of root_task_group

Hi,

The following patch fix a initialization issue.

Thanks

Heechul

---
The root_task_group.cfs_bandwidth and root_task_group.shares were initialized multiple times unnecessarily which are corrected by this patch.

---
 kernel/sched/core.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
kernel/sched/core.c +5 -2
index ca8fd44..0ed6978 100644
@@ -6772,6 +6772,11 @@ void __init sched_init(void)
 	autogroup_init(&init_task);
 #endif /* CONFIG_CGROUP_SCHED */
 
+#ifdef CONFIG_FAIR_GROUP_SCHED
+	root_task_group.shares = ROOT_TASK_GROUP_LOAD;
+	init_cfs_bandwidth(&root_task_group.cfs_bandwidth);
+#endif /* CONFIG_FAIR_GROUP_SCHED */
+
 	for_each_possible_cpu(i) {
 		struct rq *rq;
 
@@ -6783,7 +6788,6 @@ void __init sched_init(void)
 		init_cfs_rq(&rq->cfs);
 		init_rt_rq(&rq->rt, rq);
 #ifdef CONFIG_FAIR_GROUP_SCHED
-		root_task_group.shares = ROOT_TASK_GROUP_LOAD;
 		INIT_LIST_HEAD(&rq->leaf_cfs_rq_list);
 		/*
 		 * How much cpu bandwidth does root_task_group get?
@@ -6804,7 +6808,6 @@ void __init sched_init(void)
 		 * We achieve this by letting root_task_group's tasks sit
 		 * directly in rq->cfs (i.e root_task_group->se[] = NULL).
 		 */
-		init_cfs_bandwidth(&root_task_group.cfs_bandwidth);
 		init_tg_cfs_entry(&root_task_group, &rq->cfs, NULL, i, NULL);
 #endif /* CONFIG_FAIR_GROUP_SCHED */
 
Signature · 1 line
1.7.5.4
#2 lore raw
In reply to Heechul Yun
Quoted 4 lines · Heechul Yun

Hi,

The following patch fix a initialization issue.

Quoted 8 lines

Thanks

Heechul

---
The root_task_group.cfs_bandwidth and root_task_group.shares were initialized multiple times unnecessarily which are corrected by this patch.

The changelog and you comment above contradict each other. Multiple initialization isn't a bug, therefore there isn't anything an issue as such and nothing to 'fix'.

Anyway, the patch adds #ifdeffery, I really rather prefer the double init over more #ifdeffery.

If you can sort it without introducing more #ifdeffery, or rather, even reduce the #ifdeffery, I'll take it.