From: Ankit Jain <ankitja@vmware.com>
To: juri.lelli@redhat.com, bristot@redhat.com,
l.stach@pengutronix.de, suhui_kernel@163.com,
msimmons@redhat.com, peterz@infradead.org, glenn@aurora.tech,
stable@vger.kernel.org, linux-kernel@vger.kernel.org,
gregkh@linuxfoundation.org
Cc: srivatsab@vmware.com, srivatsa@csail.mit.edu, akaher@vmware.com,
amakhalov@vmware.com, vsirnapalli@vmware.com,
sturlapati@vmware.com, bordoloih@vmware.com,
keerthanak@vmware.com, Ankit Jain <ankitja@vmware.com>
Subject: [PATCH v4.19.y 2/4] sched/deadline: Fix stale throttling on de-/boosted tasks
Date: Mon, 22 Aug 2022 13:13:46 +0530 [thread overview]
Message-ID: <20220822074348.218135-3-ankitja@vmware.com> (raw)
In-Reply-To: <20220822074348.218135-1-ankitja@vmware.com>
From: Lucas Stach <l.stach@pengutronix.de>
commit 46fcc4b00c3cca8adb9b7c9afdd499f64e427135 upstream.
When a boosted task gets throttled, what normally happens is that it's
immediately enqueued again with ENQUEUE_REPLENISH, which replenishes the
runtime and clears the dl_throttled flag. There is a special case however:
if the throttling happened on sched-out and the task has been deboosted in
the meantime, the replenish is skipped as the task will return to its
normal scheduling class. This leaves the task with the dl_throttled flag
set.
Now if the task gets boosted up to the deadline scheduling class again
while it is sleeping, it's still in the throttled state. The normal wakeup
however will enqueue the task with ENQUEUE_REPLENISH not set, so we don't
actually place it on the rq. Thus we end up with a task that is runnable,
but not actually on the rq and neither a immediate replenishment happens,
nor is the replenishment timer set up, so the task is stuck in
forever-throttled limbo.
Clear the dl_throttled flag before dropping back to the normal scheduling
class to fix this issue.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Juri Lelli <juri.lelli@redhat.com>
Link: https://lkml.kernel.org/r/20200831110719.2126930-1-l.stach@pengutronix.de
[Ankit: Regenerated the patch for v4.19.y]
Signed-off-by: Ankit Jain <ankitja@vmware.com>
---
kernel/sched/deadline.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 1f8444d9df9d..29cd4c0a92c0 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1507,12 +1507,15 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
}
} else if (!dl_prio(p->normal_prio)) {
/*
- * Special case in which we have a !SCHED_DEADLINE task
- * that is going to be deboosted, but exceeds its
- * runtime while doing so. No point in replenishing
- * it, as it's going to return back to its original
- * scheduling class after this.
+ * Special case in which we have a !SCHED_DEADLINE task that is going
+ * to be deboosted, but exceeds its runtime while doing so. No point in
+ * replenishing it, as it's going to return back to its original
+ * scheduling class after this. If it has been throttled, we need to
+ * clear the flag, otherwise the task may wake up as throttled after
+ * being boosted again with no means to replenish the runtime and clear
+ * the throttle.
*/
+ p->dl.dl_throttled = 0;
BUG_ON(!p->dl.dl_boosted || flags != ENQUEUE_REPLENISH);
return;
}
--
2.34.1
next prev parent reply other threads:[~2022-08-22 7:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-22 7:43 [PATCH v4.19.y 0/4] sched/deadline: Fix panic due to nested priority inheritance Ankit Jain
2022-08-22 7:43 ` [PATCH v4.19.y 1/4] sched/deadline: Unthrottle PI boosted threads while enqueuing Ankit Jain
2022-08-22 7:43 ` Ankit Jain [this message]
2022-08-22 7:43 ` [PATCH v4.19.y 3/4] sched/deadline: Fix priority inheritance with multiple scheduling classes Ankit Jain
2022-08-22 7:43 ` [PATCH v4.19.y 4/4] kernel/sched: Remove dl_boosted flag comment Ankit Jain
2022-08-25 12:31 ` [PATCH v4.19.y 0/4] sched/deadline: Fix panic due to nested priority inheritance Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220822074348.218135-3-ankitja@vmware.com \
--to=ankitja@vmware.com \
--cc=akaher@vmware.com \
--cc=amakhalov@vmware.com \
--cc=bordoloih@vmware.com \
--cc=bristot@redhat.com \
--cc=glenn@aurora.tech \
--cc=gregkh@linuxfoundation.org \
--cc=juri.lelli@redhat.com \
--cc=keerthanak@vmware.com \
--cc=l.stach@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=msimmons@redhat.com \
--cc=peterz@infradead.org \
--cc=srivatsa@csail.mit.edu \
--cc=srivatsab@vmware.com \
--cc=stable@vger.kernel.org \
--cc=sturlapati@vmware.com \
--cc=suhui_kernel@163.com \
--cc=vsirnapalli@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox