mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
sched/deadline: Correctly handle active 0-lag timers
commit 1b02cd6a2d upstream.
syzbot reported the following warning:
[ ] WARNING: CPU: 4 PID: 17089 at kernel/sched/deadline.c:255 task_non_contending+0xae0/0x1950
line 255 of deadline.c is:
WARN_ON(hrtimer_active(&dl_se->inactive_timer));
in task_non_contending().
Unfortunately, in some cases (for example, a deadline task
continuosly blocking and waking immediately) it can happen that
a task blocks (and task_non_contending() is called) while the
0-lag timer is still active.
In this case, the safest thing to do is to immediately decrease
the running bandwidth of the task, without trying to re-arm the 0-lag timer.
Signed-off-by: luca abeni <luca.abeni@santannapisa.it>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Juri Lelli <juri.lelli@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: chengjian (D) <cj.chengjian@huawei.com>
Link: https://lkml.kernel.org/r/20190325131530.34706-1-luca.abeni@santannapisa.it
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
33c6b9ca70
commit
c22cb4bd1a
@@ -217,7 +217,6 @@ static void task_non_contending(struct task_struct *p)
|
||||
if (dl_se->dl_runtime == 0)
|
||||
return;
|
||||
|
||||
WARN_ON(hrtimer_active(&dl_se->inactive_timer));
|
||||
WARN_ON(dl_se->dl_non_contending);
|
||||
|
||||
zerolag_time = dl_se->deadline -
|
||||
@@ -234,7 +233,7 @@ static void task_non_contending(struct task_struct *p)
|
||||
* If the "0-lag time" already passed, decrease the active
|
||||
* utilization now, instead of starting a timer
|
||||
*/
|
||||
if (zerolag_time < 0) {
|
||||
if ((zerolag_time < 0) || hrtimer_active(&dl_se->inactive_timer)) {
|
||||
if (dl_task(p))
|
||||
sub_running_bw(dl_se->dl_bw, dl_rq);
|
||||
if (!dl_task(p) || p->state == TASK_DEAD) {
|
||||
|
||||
Reference in New Issue
Block a user