diff options
| author | Yong Zhang <yong.zhang0@gmail.com> | 2011-02-20 02:08:14 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2011-02-23 05:33:59 -0500 |
| commit | 800d4d30c8f20bd728e5741a3b77c4859a613f7c (patch) | |
| tree | 1eb329fb8a1dce1c1432c07e19494a3e1fb68499 | |
| parent | 1747b21fecbfb63fbf6b9624e8b92707960d5a97 (diff) | |
sched, autogroup: Stop going ahead if autogroup is disabled
when autogroup is disable from the beginning,
sched_autogroup_create_attach()
autogroup_move_group() <== 1
sched_move_task() <== 2
task_move_group_fair()
set_task_rq()
task_group()
autogroup_task_group()
We go the whole path without doing anything useful.
Then stop going further if autogroup is disabled.
But there will be a race window between 1 and 2, in which
sysctl_sched_autogroup_enabled is enabled. This issue
will be toke by following patch.
Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1298185696-4403-4-git-send-email-yong.zhang0@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
| -rw-r--r-- | kernel/sched_autogroup.c | 4 | ||||
| -rw-r--r-- | kernel/sched_autogroup.h | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/kernel/sched_autogroup.c b/kernel/sched_autogroup.c index 9fb656283157..137a096ae9d8 100644 --- a/kernel/sched_autogroup.c +++ b/kernel/sched_autogroup.c | |||
| @@ -161,11 +161,15 @@ autogroup_move_group(struct task_struct *p, struct autogroup *ag) | |||
| 161 | 161 | ||
| 162 | p->signal->autogroup = autogroup_kref_get(ag); | 162 | p->signal->autogroup = autogroup_kref_get(ag); |
| 163 | 163 | ||
| 164 | if (!ACCESS_ONCE(sysctl_sched_autogroup_enabled)) | ||
| 165 | goto out; | ||
| 166 | |||
| 164 | t = p; | 167 | t = p; |
| 165 | do { | 168 | do { |
| 166 | sched_move_task(t); | 169 | sched_move_task(t); |
| 167 | } while_each_thread(p, t); | 170 | } while_each_thread(p, t); |
| 168 | 171 | ||
| 172 | out: | ||
| 169 | unlock_task_sighand(p, &flags); | 173 | unlock_task_sighand(p, &flags); |
| 170 | autogroup_kref_put(prev); | 174 | autogroup_kref_put(prev); |
| 171 | } | 175 | } |
diff --git a/kernel/sched_autogroup.h b/kernel/sched_autogroup.h index 7b859ffe5dad..05577055cfca 100644 --- a/kernel/sched_autogroup.h +++ b/kernel/sched_autogroup.h | |||
| @@ -1,6 +1,11 @@ | |||
| 1 | #ifdef CONFIG_SCHED_AUTOGROUP | 1 | #ifdef CONFIG_SCHED_AUTOGROUP |
| 2 | 2 | ||
| 3 | struct autogroup { | 3 | struct autogroup { |
| 4 | /* | ||
| 5 | * reference doesn't mean how many thread attach to this | ||
| 6 | * autogroup now. It just stands for the number of task | ||
| 7 | * could use this autogroup. | ||
| 8 | */ | ||
| 4 | struct kref kref; | 9 | struct kref kref; |
| 5 | struct task_group *tg; | 10 | struct task_group *tg; |
| 6 | struct rw_semaphore lock; | 11 | struct rw_semaphore lock; |
