From: Daniel Bristot de Oliveira <bristot@kernel.org>
To: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Valentin Schneider <vschneid@redhat.com>,
linux-kernel@vger.kernel.org,
Luca Abeni <luca.abeni@santannapisa.it>,
Tommaso Cucinotta <tommaso.cucinotta@santannapisa.it>,
Thomas Gleixner <tglx@linutronix.de>,
Joel Fernandes <joel@joelfernandes.org>,
Vineeth Pillai <vineeth@bitbyteword.org>,
Shuah Khan <skhan@linuxfoundation.org>,
bristot@kernel.org, Phil Auld <pauld@redhat.com>,
Suleiman Souhlal <suleiman@google.com>,
Youssef Esmat <youssefesmat@google.com>
Subject: [PATCH V6 4/6] sched/core: Fix priority checking for DL server picks
Date: Fri, 5 Apr 2024 19:32:52 +0200 [thread overview]
Message-ID: <5c199284e572a65e71f445be3c26d2711834d910.1712337227.git.bristot@kernel.org> (raw)
In-Reply-To: <cover.1712337227.git.bristot@kernel.org>
From: "Joel Fernandes (Google)" <joel@joelfernandes.org>
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.
Reviewed-by: Vineeth Pillai <vineeth@bitbyteword.org>
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>
---
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 04e2270487b7..4881e797ae07 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -162,6 +162,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] */
@@ -191,8 +194,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);
--
2.44.0
next prev parent reply other threads:[~2024-04-05 17:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-05 17:27 [PATCH V6 0/6] SCHED_DEADLINE server infrastructure Daniel Bristot de Oliveira
2024-04-05 17:28 ` [PATCH V6 1/6] sched/fair: Add trivial fair server Daniel Bristot de Oliveira
2024-04-10 17:24 ` Peter Zijlstra
2024-04-11 7:28 ` Daniel Bristot de Oliveira
2024-04-05 17:28 ` [PATCH V6 2/6] sched/deadline: Deferrable dl server Daniel Bristot de Oliveira
2024-04-10 17:47 ` Peter Zijlstra
2024-04-11 7:57 ` Daniel Bristot de Oliveira
2024-05-02 8:35 ` Daniel Bristot de Oliveira
2024-05-02 8:45 ` Peter Zijlstra
2024-04-05 17:28 ` [PATCH V6 3/6] sched/fair: Fair server interface Daniel Bristot de Oliveira
2024-04-11 14:43 ` Peter Zijlstra
2024-04-11 15:02 ` Daniel Bristot de Oliveira
2024-04-12 7:43 ` Peter Zijlstra
2024-04-12 8:27 ` Daniel Bristot de Oliveira
2024-04-05 17:32 ` Daniel Bristot de Oliveira [this message]
2024-04-05 17:33 ` [PATCH V6 5/6] sched/core: Fix picking of tasks for core scheduling with DL server Daniel Bristot de Oliveira
2024-04-05 17:33 ` [PATCH V6 6/6] sched/rt: Remove default bandwidth control Daniel Bristot de Oliveira
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=5c199284e572a65e71f445be3c26d2711834d910.1712337227.git.bristot@kernel.org \
--to=bristot@kernel.org \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=joel@joelfernandes.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.abeni@santannapisa.it \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=pauld@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=skhan@linuxfoundation.org \
--cc=suleiman@google.com \
--cc=tglx@linutronix.de \
--cc=tommaso.cucinotta@santannapisa.it \
--cc=vincent.guittot@linaro.org \
--cc=vineeth@bitbyteword.org \
--cc=vschneid@redhat.com \
--cc=youssefesmat@google.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
all inboxes | Powered by JetHome®