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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240801035906.72603-1-jiahao.os@bytedance.com>
Date: Thu,  1 Aug 2024 11:59:06 +0800
From: Hao Jia <jiahao.os@...edance.com>
To: mingo@...hat.com,
	peterz@...radead.org,
	mingo@...nel.org,
	juri.lelli@...hat.com,
	vincent.guittot@...aro.org,
	dietmar.eggemann@....com,
	rostedt@...dmis.org,
	bsegall@...gle.com,
	mgorman@...e.de,
	bristot@...hat.com,
	vschneid@...hat.com
Cc: linux-kernel@...r.kernel.org,
	Hao Jia <jiahao.os@...edance.com>
Subject: [PATCH] sched/eevdf: Fixed se->deadline possibly being refilled twice in yield_task_fair()

We call update_deadline() in yield_task_fair(), if se->deadline has been
refilled in update_deadline(). We should avoid filling se->deadline again
in yield_task_fair().

Fixes: 5e963f2bd465 ("sched/fair: Commit to EEVDF")
Signed-off-by: Hao Jia <jiahao.os@...edance.com>
---
 kernel/sched/fair.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 795ceef5e7e1..b0949e670bc4 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8695,6 +8695,7 @@ static void yield_task_fair(struct rq *rq)
 	struct task_struct *curr = rq->curr;
 	struct cfs_rq *cfs_rq = task_cfs_rq(curr);
 	struct sched_entity *se = &curr->se;
+	u64 deadline_snap = se->deadline;
 
 	/*
 	 * Are we the only task in the tree?
@@ -8716,6 +8717,14 @@ static void yield_task_fair(struct rq *rq)
 	 */
 	rq_clock_skip_update(rq);
 
+	/*
+	 * If se->deadline has been refilled in
+	 * update_curr()->update_deadline(),
+	 * skip updating again.
+	 */
+	if (READ_ONCE(se->deadline) != deadline_snap)
+		return;
+
 	se->deadline += calc_delta_fair(se->slice, se);
 }
 
-- 
2.20.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ