From: "tip-bot2 for Joel Fernandes (Google)" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Suleiman Souhlal <suleiman@google.com>,
"Joel Fernandes (Google)" <joel@joelfernandes.org>,
Daniel Bristot de Oliveira <bristot@kernel.org>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Vineeth Pillai <vineeth@bitbyteword.org>,
Juri Lelli <juri.lelli@redhat.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/core] sched/core: Fix priority checking for DL server picks
Date: Mon, 29 Jul 2024 10:34:03 -0000 [thread overview]
Message-ID: <172224924308.2215.6808870474287482096.tip-bot2@tip-bot2> (raw)
In-Reply-To: <48b78521d86f3b33c24994d843c1aad6b987dda9.1716811044.git.bristot@kernel.org>
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 4b26cfdd395638918e370f62bd2c33e6f63ffb5e
Gitweb: https://git.kernel.org/tip/4b26cfdd395638918e370f62bd2c33e6f63ffb5e
Author: Joel Fernandes (Google) <joel@joelfernandes.org>
AuthorDate: Mon, 27 May 2024 14:06:53 +02:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 29 Jul 2024 12:22:36 +02:00
sched/core: Fix priority checking for DL server picks
In core scheduling, a DL server pick (which is CFS task) should be
given higher priority than tasks in other classes.
Not doing so causes CFS starvation. A kselftest is added later to
demonstrate this. A CFS task that is competing with RT tasks can
be completely starved without this and the DL server's boosting
completely ignored.
Fix these problems.
Reported-by: Suleiman Souhlal <suleiman@google.com>
Signed-off-by: "Joel Fernandes (Google)" <joel@joelfernandes.org>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Vineeth Pillai <vineeth@bitbyteword.org>
Tested-by: Juri Lelli <juri.lelli@redhat.com>
Link: https://lore.kernel.org/r/48b78521d86f3b33c24994d843c1aad6b987dda9.1716811044.git.bristot@kernel.org
---
kernel/sched/core.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f95600c..11abfcd 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -163,6 +163,9 @@ static inline int __task_prio(const struct task_struct *p)
if (p->sched_class == &stop_sched_class) /* trumps deadline */
return -2;
+ if (p->dl_server)
+ return -1; /* deadline */
+
if (rt_prio(p->prio)) /* includes deadline */
return p->prio; /* [-1, 99] */
@@ -192,8 +195,24 @@ static inline bool prio_less(const struct task_struct *a,
if (-pb < -pa)
return false;
- if (pa == -1) /* dl_prio() doesn't work because of stop_class above */
- return !dl_time_before(a->dl.deadline, b->dl.deadline);
+ if (pa == -1) { /* dl_prio() doesn't work because of stop_class above */
+ const struct sched_dl_entity *a_dl, *b_dl;
+
+ a_dl = &a->dl;
+ /*
+ * Since,'a' and 'b' can be CFS tasks served by DL server,
+ * __task_prio() can return -1 (for DL) even for those. In that
+ * case, get to the dl_server's DL entity.
+ */
+ if (a->dl_server)
+ a_dl = a->dl_server;
+
+ b_dl = &b->dl;
+ if (b->dl_server)
+ b_dl = b->dl_server;
+
+ return !dl_time_before(a_dl->deadline, b_dl->deadline);
+ }
if (pa == MAX_RT_PRIO + MAX_NICE) /* fair */
return cfs_prio_less(a, b, in_fi);
next prev parent reply other threads:[~2024-07-29 10:34 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 12:06 [PATCH V7 0/9] SCHED_DEADLINE server infrastructure Daniel Bristot de Oliveira
2024-05-27 12:06 ` [PATCH V7 1/9] sched/deadline: Comment sched_dl_entity::dl_server variable Daniel Bristot de Oliveira
2024-07-29 10:34 ` [tip: sched/core] " tip-bot2 for Daniel Bristot de Oliveira
2024-05-27 12:06 ` [PATCH V7 2/9] sched/core: Add clearing of ->dl_server in put_prev_task_balance() Daniel Bristot de Oliveira
2024-07-29 10:34 ` [tip: sched/core] " tip-bot2 for Joel Fernandes (Google)
2024-05-27 12:06 ` [PATCH V7 3/9] sched/core: Clear prev->dl_server in CFS pick fast path Daniel Bristot de Oliveira
2024-07-29 10:34 ` [tip: sched/core] " tip-bot2 for Youssef Esmat
2024-05-27 12:06 ` [PATCH V7 4/9] sched/fair: Add trivial fair server Daniel Bristot de Oliveira
2024-07-29 10:34 ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2024-05-27 12:06 ` [PATCH V7 5/9] sched/deadline: Deferrable dl server Daniel Bristot de Oliveira
2024-07-29 10:34 ` [tip: sched/core] " tip-bot2 for Daniel Bristot de Oliveira
2024-05-27 12:06 ` [PATCH V7 6/9] sched/fair: Fair server interface Daniel Bristot de Oliveira
2024-07-29 10:34 ` [tip: sched/core] " tip-bot2 for Daniel Bristot de Oliveira
2024-05-27 12:06 ` [PATCH V7 7/9] sched/core: Fix priority checking for DL server picks Daniel Bristot de Oliveira
2024-07-29 10:34 ` tip-bot2 for Joel Fernandes (Google) [this message]
2024-05-27 12:06 ` [PATCH V7 8/9] sched/core: Fix picking of tasks for core scheduling with DL server Daniel Bristot de Oliveira
2024-07-29 10:34 ` [tip: sched/core] " tip-bot2 for Joel Fernandes (Google)
2024-05-27 12:06 ` [PATCH V7 9/9] sched/rt: Remove default bandwidth control Daniel Bristot de Oliveira
2024-07-29 10:34 ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2024-11-27 10:55 ` [PATCH V7 9/9] " Michal Koutný
2024-11-27 15:35 ` Juri Lelli
2024-11-29 10:02 ` Michal Koutný
2024-11-29 14:44 ` Juri Lelli
2024-11-29 20:21 ` Michal Koutný
2024-12-02 9:39 ` Juri Lelli
2024-06-21 13:37 ` [PATCH V7 0/9] SCHED_DEADLINE server infrastructure Juri Lelli
2024-06-21 13:43 ` Daniel Bristot de Oliveira
2024-06-21 13:50 ` Juri Lelli
2024-06-21 14:41 ` Vineeth Remanan Pillai
2024-06-21 14:59 ` Daniel Bristot de Oliveira
2024-06-21 15:09 ` Vineeth Remanan Pillai
2024-06-21 15:16 ` Daniel Bristot de Oliveira
2024-07-29 10:32 ` Peter Zijlstra
2024-07-29 20:42 ` Vineeth Remanan Pillai
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=172224924308.2215.6808870474287482096.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=bristot@kernel.org \
--cc=joel@joelfernandes.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=suleiman@google.com \
--cc=vineeth@bitbyteword.org \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®