]> err.no Git - linux-2.6/blobdiff - kernel/sched.c
[POWERPC] spufs: fix order of sputrace thread IDs
[linux-2.6] / kernel / sched.c
index d2f4398c5e6f1b3feae409312c612758df9fe851..f28f19e65b598af5dca9c8985af38febfaada9ff 100644 (file)
@@ -4584,6 +4584,15 @@ recheck:
                        return -EPERM;
        }
 
+#ifdef CONFIG_RT_GROUP_SCHED
+       /*
+        * Do not allow realtime tasks into groups that have no runtime
+        * assigned.
+        */
+       if (rt_policy(policy) && task_group(p)->rt_runtime == 0)
+               return -EPERM;
+#endif
+
        retval = security_task_setscheduler(p, policy, param);
        if (retval)
                return retval;
@@ -8028,9 +8037,15 @@ static int
 cpu_cgroup_can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
                      struct task_struct *tsk)
 {
+#ifdef CONFIG_RT_GROUP_SCHED
+       /* Don't accept realtime tasks when there is no way for them to run */
+       if (rt_task(tsk) && cgroup_tg(cgrp)->rt_runtime == 0)
+               return -EINVAL;
+#else
        /* We don't support RT-tasks being in separate groups */
        if (tsk->sched_class != &fair_sched_class)
                return -EINVAL;
+#endif
 
        return 0;
 }