diff options
author | Mike Galbraith <efault@gmx.de> | 2011-02-22 09:02:00 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-02-23 05:34:03 -0500 |
commit | 511f67a5997c4967c69a3961e2fc9f04d8d244ac (patch) | |
tree | a40c00578794d26cc98d710bd0649228ab84cc97 /kernel/sched_autogroup.c | |
parent | 800d4d30c8f20bd728e5741a3b77c4859a613f7c (diff) |
sched, autogroup: Stop claiming ownership of the root task group
Disown it, and only display autogroup association if one exists.
Signed-off-by: Mike Galbraith <efault@gmx.de>
Reviewed-by: Yong Zhang <yong.zhang0@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1298383320.8036.5.camel@marge.simson.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched_autogroup.c')
-rw-r--r-- | kernel/sched_autogroup.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/kernel/sched_autogroup.c b/kernel/sched_autogroup.c index 137a096ae9d8..5946ac515602 100644 --- a/kernel/sched_autogroup.c +++ b/kernel/sched_autogroup.c | |||
@@ -12,7 +12,6 @@ static atomic_t autogroup_seq_nr; | |||
12 | static void __init autogroup_init(struct task_struct *init_task) | 12 | static void __init autogroup_init(struct task_struct *init_task) |
13 | { | 13 | { |
14 | autogroup_default.tg = &root_task_group; | 14 | autogroup_default.tg = &root_task_group; |
15 | root_task_group.autogroup = &autogroup_default; | ||
16 | kref_init(&autogroup_default.kref); | 15 | kref_init(&autogroup_default.kref); |
17 | init_rwsem(&autogroup_default.lock); | 16 | init_rwsem(&autogroup_default.lock); |
18 | init_task->signal->autogroup = &autogroup_default; | 17 | init_task->signal->autogroup = &autogroup_default; |
@@ -130,7 +129,7 @@ task_wants_autogroup(struct task_struct *p, struct task_group *tg) | |||
130 | 129 | ||
131 | static inline bool task_group_is_autogroup(struct task_group *tg) | 130 | static inline bool task_group_is_autogroup(struct task_group *tg) |
132 | { | 131 | { |
133 | return tg != &root_task_group && tg->autogroup; | 132 | return !!tg->autogroup; |
134 | } | 133 | } |
135 | 134 | ||
136 | static inline struct task_group * | 135 | static inline struct task_group * |
@@ -251,10 +250,14 @@ void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m) | |||
251 | { | 250 | { |
252 | struct autogroup *ag = autogroup_task_get(p); | 251 | struct autogroup *ag = autogroup_task_get(p); |
253 | 252 | ||
253 | if (!task_group_is_autogroup(ag->tg)) | ||
254 | goto out; | ||
255 | |||
254 | down_read(&ag->lock); | 256 | down_read(&ag->lock); |
255 | seq_printf(m, "/autogroup-%ld nice %d\n", ag->id, ag->nice); | 257 | seq_printf(m, "/autogroup-%ld nice %d\n", ag->id, ag->nice); |
256 | up_read(&ag->lock); | 258 | up_read(&ag->lock); |
257 | 259 | ||
260 | out: | ||
258 | autogroup_kref_put(ag); | 261 | autogroup_kref_put(ag); |
259 | } | 262 | } |
260 | #endif /* CONFIG_PROC_FS */ | 263 | #endif /* CONFIG_PROC_FS */ |
@@ -262,9 +265,7 @@ void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m) | |||
262 | #ifdef CONFIG_SCHED_DEBUG | 265 | #ifdef CONFIG_SCHED_DEBUG |
263 | static inline int autogroup_path(struct task_group *tg, char *buf, int buflen) | 266 | static inline int autogroup_path(struct task_group *tg, char *buf, int buflen) |
264 | { | 267 | { |
265 | int enabled = ACCESS_ONCE(sysctl_sched_autogroup_enabled); | 268 | if (!task_group_is_autogroup(tg)) |
266 | |||
267 | if (!enabled || !tg->autogroup) | ||
268 | return 0; | 269 | return 0; |
269 | 270 | ||
270 | return snprintf(buf, buflen, "%s-%ld", "/autogroup", tg->autogroup->id); | 271 | return snprintf(buf, buflen, "%s-%ld", "/autogroup", tg->autogroup->id); |