aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched/auto_group.h
diff options
context:
space:
mode:
authorMike Galbraith <efault@gmx.de>2012-10-28 15:19:23 -0400
committerIngo Molnar <mingo@kernel.org>2012-10-30 05:26:04 -0400
commit5258f386ea4e8454bc801fb443e8a4217da1947c (patch)
treec97487f040b95f83a2c9d31d51cbfe57f35e59e3 /kernel/sched/auto_group.h
parent8ed92e51f99c2199c64cb33b4ba95ab12940a94c (diff)
sched/autogroup: Fix crash on reboot when autogroup is disabled
Due to these two commits: 8323f26ce342 sched: Fix race in task_group() 800d4d30c8f2 sched, autogroup: Stop going ahead if autogroup is disabled ... autogroup scheduling's dynamic knobs are wrecked. With both patches applied, all you have to do to crash a box is disable autogroup during boot up, then reboot.. boom, NULL pointer dereference due to 800d4d30 not allowing autogroup to move things, and 8323f26ce making that the only way to switch runqueues. Remove most of the (dysfunctional) knobs and turn the remaining sched_autogroup_enabled knob readonly. If the user fiddles with cgroups hereafter, once tasks are moved, autogroup won't mess with them again unless they call setsid(). No knobs, no glitz, nada, just a cute little thing folks can turn on if they don't want to muck about with cgroups and/or systemd. Signed-off-by: Mike Galbraith <efault@gmx.de> Cc: Xiaotian Feng <xtfeng@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Xiaotian Feng <dannyfeng@tencent.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: <stable@vger.kernel.org> # v3.6 Link: http://lkml.kernel.org/r/1351451963.4999.8.camel@maggy.simpson.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/auto_group.h')
-rw-r--r--kernel/sched/auto_group.h9
1 files changed, 1 insertions, 8 deletions
diff --git a/kernel/sched/auto_group.h b/kernel/sched/auto_group.h
index 8bd047142816..4552c6bf79d2 100644
--- a/kernel/sched/auto_group.h
+++ b/kernel/sched/auto_group.h
@@ -4,11 +4,6 @@
4#include <linux/rwsem.h> 4#include <linux/rwsem.h>
5 5
6struct autogroup { 6struct autogroup {
7 /*
8 * reference doesn't mean how many thread attach to this
9 * autogroup now. It just stands for the number of task
10 * could use this autogroup.
11 */
12 struct kref kref; 7 struct kref kref;
13 struct task_group *tg; 8 struct task_group *tg;
14 struct rw_semaphore lock; 9 struct rw_semaphore lock;
@@ -29,9 +24,7 @@ extern bool task_wants_autogroup(struct task_struct *p, struct task_group *tg);
29static inline struct task_group * 24static inline struct task_group *
30autogroup_task_group(struct task_struct *p, struct task_group *tg) 25autogroup_task_group(struct task_struct *p, struct task_group *tg)
31{ 26{
32 int enabled = ACCESS_ONCE(sysctl_sched_autogroup_enabled); 27 if (task_wants_autogroup(p, tg))
33
34 if (enabled && task_wants_autogroup(p, tg))
35 return p->signal->autogroup->tg; 28 return p->signal->autogroup->tg;
36 29
37 return tg; 30 return tg;