Commit: 9d5142624256 ("sched/deadline: Reduce rq lock contention by eliminating locking of non-feasible target") broke select_task_rq_dl() and find_lock_later_rq(), because it introduced a comparison between the local task's deadline and dl.earliest_dl.curr of the remote queue. However, if the remote runqueue does not contain any SCHED_DEADLINE task its earliest_dl.curr is 0 (always smaller than the deadline of the local task) and the remote runqueue is not selected for pushing. As a result, if an application creates multiple SCHED_DEADLINE threads, they will never be pushed to runqueues that do not already contain SCHED_DEADLINE tasks. This patch fixes the issue by checking if dl.dl_nr_running == 0.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -1066,8 +1066,9 @@ select_task_rq_dl(struct task_struct *p, int cpu, int sd_flag, int flags) · 1065 unmodified lines | |||
| 1066 | int target = find_later_rq(p); | 1066 | int target = find_later_rq(p); |
| 1067 | 1067 | ||
| 1068 | if (target != -1 && | 1068 | if (target != -1 && |
| 1069 | dl_time_before(p->dl.deadline, | 1069 | (dl_time_before(p->dl.deadline, |
| 1070 | cpu_rq(target)->dl.earliest_dl.curr)) | 1070 | cpu_rq(target)->dl.earliest_dl.curr) || |
| 1071 | (cpu_rq(target)->dl.dl_nr_running == 0))) | ||
| 1071 | cpu = target; | 1072 | cpu = target; |
| 1072 | } | 1073 | } |
| 1073 | rcu_read_unlock(); | 1074 | rcu_read_unlock(); |
| @@ -1417,7 +1418,8 @@ static struct rq *find_lock_later_rq(struct task_struct *task, struct rq *rq) · 343 unmodified lines | |||
| 1417 | 1418 | ||
| 1418 | later_rq = cpu_rq(cpu); | 1419 | later_rq = cpu_rq(cpu); |
| 1419 | 1420 | ||
| 1420 | if (!dl_time_before(task->dl.deadline, | 1421 | if (later_rq->dl.dl_nr_running && |
| 1422 | !dl_time_before(task->dl.deadline, | ||
| 1421 | later_rq->dl.earliest_dl.curr)) { | 1423 | later_rq->dl.earliest_dl.curr)) { |
| 1422 | /* | 1424 | /* |
| 1423 | * Target rq has tasks of equal or earlier deadline, | 1425 | * Target rq has tasks of equal or earlier deadline, |