It is easier to track the restrictions imposed on SCHED_DEADLINE tasks if we keep them all together in a single function.
No function changes. Signed-off-by: Daniel Bristot de Oliveira <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Juri Lelli <[email protected]> Cc: Vincent Guittot <[email protected]> Cc: Dietmar Eggemann <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Ben Segall <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Daniel Bristot de Oliveira <[email protected]> Cc: Li Zefan <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Valentin Schneider <[email protected]> Cc: [email protected] Cc: [email protected] --- kernel/sched/core.c | 3 +-- kernel/sched/deadline.c | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 7af80c3fce12..f4aede34449c 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7142,8 +7142,7 @@ int task_can_attach(struct task_struct *p, goto out; } - if (dl_task(p) && !cpumask_intersects(task_rq(p)->rd->span, - cs_cpus_allowed)) + if (dl_task(p)) ret = dl_task_can_attach(p, cs_cpus_allowed); out: diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 75686c6d4436..c97d2c707b98 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -2870,6 +2870,13 @@ int dl_task_can_attach(struct task_struct *p, const struct cpumask *cs_cpus_allo bool overflow; int ret; + /* + * The task is not moving to another root domain, so it is + * already accounted. + */ + if (cpumask_intersects(task_rq(p)->rd->span, cs_cpus_allowed)) + return 0; + dest_cpu = cpumask_any_and(cpu_active_mask, cs_cpus_allowed); rcu_read_lock_sched(); -- 2.29.2

