diff options
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r-- | kernel/sched/core.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 0d8badcf1f0f..b930857f4d14 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4237,6 +4237,26 @@ change: cpumask_t *span = rq->rd->span; /* + * If setscheduling to SCHED_DEADLINE we need to make + * sure the task is constrained to run within the root + * domain it is associated with, something that isn't + * guaranteed when using cpusets. + * + * Speaking of cpusets, we also need to assert that a + * task's cpus_allowed mask equals its cpuset's + * cpus_allowed mask. Otherwise a DL task could be + * assigned to a cpuset that has more CPUs than the root + * domain it is associated with, a situation that yields + * no benefits and greatly complicate the management of + * DL task when cpusets are present. + */ + if (!cpumask_equal(&p->cpus_allowed, span) || + !cpuset_cpus_match_task(p)) { + retval = -EPERM; + goto unlock; + } + + /* * Don't allow tasks with an affinity mask smaller than * the entire root_domain to become SCHED_DEADLINE. We * will also fail if there's no bandwidth available. |