Skip to contentSkip to conversation

sched: remove root_task_group

PATCH In review Yong Zhang 3 participants 6 messages Jan 7, 2011 Scheduler

lore
Share & tools
lore

Yong Zhang

author
#0 lore raw

PATCH 1/1 sched: remove root_task_group

root_task_group is the leftover of USER_SCHED, now it's always same to init_task_group.

Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 kernel/sched.c           |    4 +---
 kernel/sched_autogroup.c |    2 +-
 kernel/sched_fair.c      |    2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)
kernel/sched.c +1 -3
index 114a0de..2ba7a7e 100644
@@ -278,8 +278,6 @@ struct task_group {
 #endif
 };
 
-#define root_task_group init_task_group
-
 /* task_group_lock serializes the addition/removal of task groups */
 static DEFINE_SPINLOCK(task_group_lock);
 
@@ -1447,7 +1445,7 @@ static int walk_tg_tree(tg_visitor down, tg_visitor up, void *data)
 	int ret;
 
 	rcu_read_lock();
-	parent = &root_task_group;
+	parent = &init_task_group;
 down:
 	ret = (*down)(parent, data);
 	if (ret)
kernel/sched_autogroup.c +1 -1
index c80fedc..ff6c88c 100644
@@ -90,7 +90,7 @@ out_fail:
 static inline bool
 task_wants_autogroup(struct task_struct *p, struct task_group *tg)
 {
-	if (tg != &root_task_group)
+	if (tg != &init_task_group)
 		return false;
 
 	if (p->sched_class != &fair_sched_class)
kernel/sched_fair.c +1 -1
index c62ebae..a994a28 100644
@@ -1348,7 +1348,7 @@ static void task_waking_fair(struct rq *rq, struct task_struct *p)
 
 #ifdef CONFIG_FAIR_GROUP_SCHED
 /*
- * effective_load() calculates the load change as seen from the root_task_group
+ * effective_load() calculates the load change as seen from the init_task_group
  *
  * Adding load to a group doesn't make a group heavier, but can cause movement
  * of group shares between cpus. Assuming the shares were perfectly aligned one
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 2 lines · Yong Zhang

root_task_group is the leftover of USER_SCHED, now it's always same to init_task_group.

Wouldn't the reverse be better? It's root as in tree.

-Mike

author
#2 lore raw

PATCH 1/1 sched: consolidate the name of root_task_group and init_task_group

Quoted 5 lines · Mike Galbraith
Quoted 2 lines · Yong Zhang

root_task_group is the leftover of USER_SCHED, now it's always same to init_task_group.

Wouldn't the reverse be better? It's root as in tree.

Well, I have no bias to either of them. Keeping init_task_group is just that we can touch less lines. :)

If you want root_task_group, here it is:
---
From: Yong Zhang <[email protected]>
Subject: [PATCH] sched: consolidate the name of root_task_group and init_task_group

root_task_group is the leftover of USER_SCHED, now it's always same to init_task_group.
But as Mike suggested, root_task_group is maybe the suitable name to keep for a tree.
So in this patch:
init_task_group --> root_task_group
init_task_group_load --> root_task_group_load INIT_TASK_GROUP_LOAD --> ROOT_TASK_GROUP_LOAD

---
 include/linux/sched.h    |    2 +-
 kernel/sched.c           |   42 ++++++++++++++++++++----------------------
 kernel/sched_autogroup.c |    6 +++---
 3 files changed, 24 insertions(+), 26 deletions(-)
include/linux/sched.h +1 -1
index 883ad10..a6b04a0 100644
@@ -2500,7 +2500,7 @@ extern void normalize_rt_tasks(void);
 
 #ifdef CONFIG_CGROUP_SCHED
 
-extern struct task_group init_task_group;
+extern struct task_group root_task_group;
 
 extern struct task_group *sched_create_group(struct task_group *parent);
 extern void sched_destroy_group(struct task_group *tg);
kernel/sched.c +20 -22

126 lines not on this page · raw message

kernel/sched_autogroup.c +3 -3
index c80fedc..e011e53 100644
@@ -11,8 +11,8 @@ static atomic_t autogroup_seq_nr;
 
 static void autogroup_init(struct task_struct *init_task)
 {
-	autogroup_default.tg = &init_task_group;
-	init_task_group.autogroup = &autogroup_default;
+	autogroup_default.tg = &root_task_group;
+	root_task_group.autogroup = &autogroup_default;
 	kref_init(&autogroup_default.kref);
 	init_rwsem(&autogroup_default.lock);
 	init_task->signal->autogroup = &autogroup_default;
@@ -63,7 +63,7 @@ static inline struct autogroup *autogroup_create(void)
 	if (!ag)
 		goto out_fail;
 
-	tg = sched_create_group(&init_task_group);
+	tg = sched_create_group(&root_task_group);
 
 	if (IS_ERR(tg))
 		goto out_free;
Signature · 1 line
1.7.0.4
maintainer
#3 lore raw

Re: [PATCH] sched: consolidate the name of root_task_group and init_task_group

Quoted 18 lines · Yong Zhang

Well, I have no bias to either of them. Keeping init_task_group is just that we can touch less lines. :)

If you want root_task_group, here it is:
---
From: Yong Zhang <[email protected]>
Subject: [PATCH] sched: consolidate the name of root_task_group and init_task_group

root_task_group is the leftover of USER_SCHED, now it's always same to init_task_group.
But as Mike suggested, root_task_group is maybe the suitable name to keep for a tree.
So in this patch:
init_task_group --> root_task_group
init_task_group_load --> root_task_group_load INIT_TASK_GROUP_LOAD --> ROOT_TASK_GROUP_LOAD

Quoted 4 lines

OK, took this one instead..

#4 lore raw

[tip:sched/urgent] sched: Consolidate the name of root_task_group and init_task_group

In reply to Yong Zhang
Commit-ID:  07e06b011db2b3300f6c975ebf293fc4c8c59942
Gitweb:     http://git.kernel.org/tip/07e06b011db2b3300f6c975ebf293fc4c8c59942
Author:     Yong Zhang <[email protected]>
AuthorDate: Fri, 7 Jan 2011 15:17:36 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 7 Jan 2011 15:54:34 +0100

sched: Consolidate the name of root_task_group and init_task_group

root_task_group is the leftover of USER_SCHED, now it's always same to init_task_group.
But as Mike suggested, root_task_group is maybe the suitable name to keep for a tree.
So in this patch:
init_task_group --> root_task_group
init_task_group_load --> root_task_group_load INIT_TASK_GROUP_LOAD --> ROOT_TASK_GROUP_LOAD

LKML-Reference: <[email protected]>

---
 include/linux/sched.h    |    2 +-
 kernel/sched.c           |   42 ++++++++++++++++++++----------------------
 kernel/sched_autogroup.c |    6 +++---
 3 files changed, 24 insertions(+), 26 deletions(-)
include/linux/sched.h +1 -1
index 777cd01..341acbb 100644
@@ -2511,7 +2511,7 @@ extern void normalize_rt_tasks(void);
 
 #ifdef CONFIG_CGROUP_SCHED
 
-extern struct task_group init_task_group;
+extern struct task_group root_task_group;
 
 extern struct task_group *sched_create_group(struct task_group *parent);
 extern void sched_destroy_group(struct task_group *tg);
kernel/sched.c +20 -22

126 lines not on this page · raw message

kernel/sched_autogroup.c +3 -3
index c80fedc..e011e53 100644
@@ -11,8 +11,8 @@ static atomic_t autogroup_seq_nr;
 
 static void autogroup_init(struct task_struct *init_task)
 {
-	autogroup_default.tg = &init_task_group;
-	init_task_group.autogroup = &autogroup_default;
+	autogroup_default.tg = &root_task_group;
+	root_task_group.autogroup = &autogroup_default;
 	kref_init(&autogroup_default.kref);
 	init_rwsem(&autogroup_default.lock);
 	init_task->signal->autogroup = &autogroup_default;
@@ -63,7 +63,7 @@ static inline struct autogroup *autogroup_create(void)
 	if (!ag)
 		goto out_fail;
 
-	tg = sched_create_group(&init_task_group);
+	tg = sched_create_group(&root_task_group);
 
 	if (IS_ERR(tg))
 		goto out_free;