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]
Date: Fri, 29 Mar 2024 17:19:33 +0800
From: Chunxin Zang <spring.cxz@...il.com>
To: mingo@...hat.com,
	peterz@...radead.org,
	juri.lelli@...hat.com,
	vincent.guittot@...aro.org
Cc: dietmar.eggemann@....com,
	rostedt@...dmis.org,
	bsegall@...gle.com,
	mgorman@...e.de,
	bristot@...hat.com,
	vschneid@...hat.com,
	linux-kernel@...r.kernel.org,
	yangchen11@...iang.com,
	zhouchunhua@...iang.com,
	zangchunxin@...iang.com,
	Chunxin Zang <spring.cxz@...il.com>
Subject: [PATCH] sched/fair: Reset vlag in dequeue when PLAGE_LAG is disabled

The vlag is calculated in dequeue when PLAGE_LAG is disabled. If we
enable the PLACE_LAG at some point, the old vlag of process will
affect itself and other process. These are not in line with our
original intention, where we expect the vlag of all processes to be
calculated from 0 after the enable PLAGE_LAG.

Reviewed-by: Chen Yang <yangchen11@...iang.com>
Signed-off-by: Chunxin Zang <spring.cxz@...il.com>
---
 kernel/sched/fair.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 03be0d1330a6..bc103a1ee78a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3798,16 +3798,17 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
 	}
 	dequeue_load_avg(cfs_rq, se);
 
-	if (!se->on_rq) {
+	if (sched_feat(PLACE_LAG) && !se->on_rq) {
 		/*
 		 * Because we keep se->vlag = V - v_i, while: lag_i = w_i*(V - v_i),
 		 * we need to scale se->vlag when w_i changes.
 		 */
 		se->vlag = div_s64(se->vlag * se->load.weight, weight);
-	} else {
-		reweight_eevdf(cfs_rq, se, weight);
 	}
 
+	if (se->on_rq)
+		reweight_eevdf(cfs_rq, se, weight);
+
 	update_load_set(&se->load, weight);
 
 #ifdef CONFIG_SMP
@@ -5382,7 +5383,11 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
 
 	clear_buddies(cfs_rq, se);
 
-	update_entity_lag(cfs_rq, se);
+	if (sched_feat(PLACE_LAG))
+		update_entity_lag(cfs_rq, se);
+	else
+		se->vlag = 0;
+
 	if (se != cfs_rq->curr)
 		__dequeue_entity(cfs_rq, se);
 	se->on_rq = 0;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ