Messages in this thread Patch in this message | | | Date | Thu, 5 Apr 2012 00:14:57 -0700 (PDT) | From | David Rientjes <> | Subject | [patch 2/2] cpu_cgroup: disallow attaching kthreadd |
| |
From: Mike Galbraith <efault@gmx.de>
An RT workqueue worker thread spawned in a cpu cgroup with no rt_runtime allocated is not schedulable. Simple user error, but harmful to the box. Save the user some unexpected trouble, just say no.
Acked-by: Paul Menage <paul@paulmenage.org> Signed-off-by: Mike Galbraith <efault@gmx.de> Signed-off-by: David Rientjes <rientjes@google.com> --- kernel/sched/core.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -72,6 +72,7 @@ #include <linux/slab.h> #include <linux/init_task.h> #include <linux/binfmts.h> +#include <linux/kthread.h> #include <asm/switch_to.h> #include <asm/tlb.h> @@ -7636,6 +7637,13 @@ static int cpu_cgroup_can_attach(struct cgroup *cgrp, if (task->sched_class != &fair_sched_class) return -EINVAL; #endif + /* + * Disallow kthreadd since it can fork workers for an RT + * workqueue in a cgroup which may or may not have rt_runtime + * allocated. + */ + if (task == kthreadd_task) + return -EINVAL; } return 0; }
| |