Skip to content

Commit

Permalink
sched, autogroup: Stop claiming ownership of the root task group
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mike Galbraith authored and Ingo Molnar committed Feb 23, 2011
1 parent 800d4d3 commit 511f67a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions kernel/sched_autogroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ static atomic_t autogroup_seq_nr;
static void __init autogroup_init(struct task_struct *init_task)
{
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;
Expand Down Expand Up @@ -130,7 +129,7 @@ task_wants_autogroup(struct task_struct *p, struct task_group *tg)

static inline bool task_group_is_autogroup(struct task_group *tg)
{
return tg != &root_task_group && tg->autogroup;
return !!tg->autogroup;
}

static inline struct task_group *
Expand Down Expand Up @@ -251,20 +250,22 @@ void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m)
{
struct autogroup *ag = autogroup_task_get(p);

if (!task_group_is_autogroup(ag->tg))
goto out;

down_read(&ag->lock);
seq_printf(m, "/autogroup-%ld nice %d\n", ag->id, ag->nice);
up_read(&ag->lock);

out:
autogroup_kref_put(ag);
}
#endif /* CONFIG_PROC_FS */

#ifdef CONFIG_SCHED_DEBUG
static inline int autogroup_path(struct task_group *tg, char *buf, int buflen)
{
int enabled = ACCESS_ONCE(sysctl_sched_autogroup_enabled);

if (!enabled || !tg->autogroup)
if (!task_group_is_autogroup(tg))
return 0;

return snprintf(buf, buflen, "%s-%ld", "/autogroup", tg->autogroup->id);
Expand Down

0 comments on commit 511f67a

Please sign in to comment.