lkml.org 
[lkml]   [2012]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
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;
}

\
 
 \ /
  Last update: 2012-04-05 09:17    [W:0.074 / U:0.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site