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: <20250619031942.25474-1-shijie@os.amperecomputing.com>
Date: Thu, 19 Jun 2025 11:19:42 +0800
From: Huang Shijie <shijie@...amperecomputing.com>
To: mingo@...hat.com,
	peterz@...radead.org
Cc: patches@...erecomputing.com,
	cl@...ux.com,
	yang@...amperecomputing.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,
	Huang Shijie <shijie@...amperecomputing.com>
Subject: [PATCH] sched/fair: set the se->vlag strictly following the paper

>From the paper, the lag should follow the limit:
     -r_max < lag < max(r_max, q)

But current code makes the lag follow the limit:
     -max(r_max, q) < lag < max(r_max, q)

This patch introduces limit_hi/limit_lo/r_max, and
make the lag follow the paper strictly.

Signed-off-by: Huang Shijie <shijie@...amperecomputing.com>
---
 kernel/sched/fair.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 83157de5b808..102d263df330 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -694,14 +694,17 @@ u64 avg_vruntime(struct cfs_rq *cfs_rq)
  */
 static void update_entity_lag(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
-	s64 vlag, limit;
+	s64 vlag, limit_hi, limit_lo, r_max;
 
 	WARN_ON_ONCE(!se->on_rq);
 
 	vlag = avg_vruntime(cfs_rq) - se->vruntime;
-	limit = calc_delta_fair(max_t(u64, 2*se->slice, TICK_NSEC), se);
+	r_max = 2 * se->slice;
 
-	se->vlag = clamp(vlag, -limit, limit);
+	limit_hi = calc_delta_fair(max_t(u64, r_max, TICK_NSEC), se);
+	limit_lo = calc_delta_fair(r_max, se);
+
+	se->vlag = clamp(vlag, -limit_lo, limit_hi);
 }
 
 /*
-- 
2.40.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ