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>] [day] [month] [year] [list]
Message-Id: <20241209090205.2181878-1-vincentzhou@bytedance.com>
Date: Mon,  9 Dec 2024 17:02:05 +0800
From: Vincent Zhou <vincentzhou@...edance.com>
To: peterz@...radead.org,
	mingo@...hat.com,
	juri.lelli@...hat.com,
	vincent.guittot@...aro.org,
	dietmar.eggemann@....com,
	rostedt@...dmis.org,
	bsegall@...gle.com,
	mgorman@...e.de,
	vschneid@...hat.com,
	linux-kernel@...r.kernel.org
Cc: vincentzhou@...edance.com
Subject: [PATCH] sched/rt: fix the error in rt task wait time calculation

From: vincentzhou <vincentzhou@...edance.com>

update_stats_wait_end_rt needs to be called in dequeue_task_rt
to update the wait_start variable, otherwise calling
update_stats_wait_start_rt again will casue a wrong small value
of wait_start because the following codes logic:
if (p && likely(wait_start > prev_wait_start))
	wait_start -= prev_wait_start;
After that, update_stats_wait_end_rt is called again, it will
calculate wait time by using current rq_clock subtracting
wait_start which will cause a very big wait time.

Signed-off-by: vincentzhou <vincentzhou@...edance.com>
---
 kernel/sched/rt.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index bd66a46b06ac..544dd55447df 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1488,6 +1488,10 @@ static bool dequeue_task_rt(struct rq *rq, struct task_struct *p, int flags)
 	struct sched_rt_entity *rt_se = &p->rt;
 
 	update_curr_rt(rq);
+
+	if (!task_current(rq, p))
+		update_stats_wait_end_rt(rt_rq_of_se(rt_se), rt_se);
+
 	dequeue_rt_entity(rt_se, flags);
 
 	dequeue_pushable_task(rq, p);
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ