lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <172224924308.2215.6808870474287482096.tip-bot2@tip-bot2>
Date: Mon, 29 Jul 2024 10:34:03 -0000
From: "tip-bot2 for Joel Fernandes (Google)" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Suleiman Souhlal <suleiman@...gle.com>,
 "Joel Fernandes (Google)" <joel@...lfernandes.org>,
 Daniel Bristot de Oliveira <bristot@...nel.org>,
 "Peter Zijlstra (Intel)" <peterz@...radead.org>,
 Vineeth Pillai <vineeth@...byteword.org>, Juri Lelli <juri.lelli@...hat.com>,
 x86@...nel.org, linux-kernel@...r.kernel.org
Subject:
 [tip: sched/core] sched/core: Fix priority checking for DL server picks

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@...lfernandes.org>
AuthorDate:    Mon, 27 May 2024 14:06:53 +02:00
Committer:     Peter Zijlstra <peterz@...radead.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@...gle.com>
Signed-off-by: "Joel Fernandes (Google)" <joel@...lfernandes.org>
Signed-off-by: Daniel Bristot de Oliveira <bristot@...nel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Reviewed-by: Vineeth Pillai <vineeth@...byteword.org>
Tested-by: Juri Lelli <juri.lelli@...hat.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);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ