Skip to content

Commit 13b5ab0

Browse files
Xunlei PangIngo Molnar
authored andcommitted
sched/rt, sched/dl: Don't push if task's scheduling class was changed
We got this warning: WARNING: CPU: 1 PID: 2468 at kernel/sched/core.c:1161 set_task_cpu+0x1af/0x1c0 [...] Call Trace: dump_stack+0x63/0x87 __warn+0xd1/0xf0 warn_slowpath_null+0x1d/0x20 set_task_cpu+0x1af/0x1c0 push_dl_task.part.34+0xea/0x180 push_dl_tasks+0x17/0x30 __balance_callback+0x45/0x5c __sched_setscheduler+0x906/0xb90 SyS_sched_setattr+0x150/0x190 do_syscall_64+0x62/0x110 entry_SYSCALL64_slow_path+0x25/0x25 This corresponds to: WARN_ON_ONCE(p->state == TASK_RUNNING && p->sched_class == &fair_sched_class && (p->on_rq && !task_on_rq_migrating(p))) It happens because in find_lock_later_rq(), the task whose scheduling class was changed to fair class is still pushed away as if it were a deadline task ... So, check in find_lock_later_rq() after double_lock_balance(), if the scheduling class of the deadline task was changed, break and retry. Apply the same logic to RT tasks. Signed-off-by: Xunlei Pang <xlpang@redhat.com> Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Juri Lelli <juri.lelli@arm.com> Link: http://lkml.kernel.org/r/1462767091-1215-1-git-send-email-xlpang@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 536bd00 commit 13b5ab0

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

kernel/sched/deadline.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,7 @@ static struct rq *find_lock_later_rq(struct task_struct *task, struct rq *rq)
13941394
!cpumask_test_cpu(later_rq->cpu,
13951395
&task->cpus_allowed) ||
13961396
task_running(rq, task) ||
1397+
!dl_task(task) ||
13971398
!task_on_rq_queued(task))) {
13981399
double_unlock_balance(rq, later_rq);
13991400
later_rq = NULL;

kernel/sched/rt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,6 +1729,7 @@ static struct rq *find_lock_lowest_rq(struct task_struct *task, struct rq *rq)
17291729
!cpumask_test_cpu(lowest_rq->cpu,
17301730
tsk_cpus_allowed(task)) ||
17311731
task_running(rq, task) ||
1732+
!rt_task(task) ||
17321733
!task_on_rq_queued(task))) {
17331734

17341735
double_unlock_balance(rq, lowest_rq);

0 commit comments

Comments
 (0)