History

sched/deadline: Fix migration of SCHED_DEADLINE tasks

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.

Luca Abeni committed 11 years ago

Commit 5aa50501 parent 0baabb31 file · +5 −3Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/sched/deadline.c+5−3
@@ -1066,8 +1066,9 @@ select_task_rq_dl(struct task_struct *p, int cpu, int sd_flag, int flags) · 1065 unmodified lines
10661066 int target = find_later_rq(p);
10671067
10681068 if (target != -1 &&
1069− dl_time_before(p->dl.deadline,
1070− cpu_rq(target)->dl.earliest_dl.curr))
1069+ (dl_time_before(p->dl.deadline,
1070+ cpu_rq(target)->dl.earliest_dl.curr) ||
1071+ (cpu_rq(target)->dl.dl_nr_running == 0)))
10711072 cpu = target;
10721073 }
10731074 rcu_read_unlock();
@@ -1417,7 +1418,8 @@ static struct rq *find_lock_later_rq(struct task_struct *task, struct rq *rq) · 343 unmodified lines
14171418
14181419 later_rq = cpu_rq(cpu);
14191420
1420− if (!dl_time_before(task->dl.deadline,
1421+ if (later_rq->dl.dl_nr_running &&
1422+ !dl_time_before(task->dl.deadline,
14211423 later_rq->dl.earliest_dl.curr)) {
14221424 /*
14231425 * Target rq has tasks of equal or earlier deadline,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t