linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] sched/pelt: Keep UTIL_AVG_UNCHANGED flag in sync when calculating last_enqueued_diff
@ 2021-05-07 11:20 Xuewen Yan
  2021-05-07 12:35 ` Vincent Donnefort
  0 siblings, 1 reply; 8+ messages in thread
From: Xuewen Yan @ 2021-05-07 11:20 UTC (permalink / raw)
  To: vincent.donnefort, mingo, peterz, juri.lelli, vincent.guittot,
	dietmar.eggemann
  Cc: rostedt, bsegall, mgorman, bristot, linux-kernel, zhang.lyra, xuewyan

From: Xuewen Yan <xuewen.yan@unisoc.com>

Last_enqueued_diff's meaning: "diff = util_est.enqueued(p) - task_util(p)".
When calculating last_enqueued_diff, we add UTIL_AVG_UNCHANGED flag, which
is the LSB, for task_util, but don't add the flag for util_est.enqueued.
However the enqueued's flag had been cleared when the task util changed.
As a result, we add +1 to the diff, this is therefore reducing slightly
UTIL_EST_MARGIN.

Add the flag for util_est.enqueued to have a accurate computation.

Fixes: b89997aa88f0b sched/pelt: Fix task util_est update filtering

Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e5e457fa9dc8..94d77b4fa601 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3996,7 +3996,7 @@ static inline void util_est_update(struct cfs_rq *cfs_rq,
 	if (ue.enqueued & UTIL_AVG_UNCHANGED)
 		return;
 
-	last_enqueued_diff = ue.enqueued;
+	last_enqueued_diff = (ue.enqueued | UTIL_AVG_UNCHANGED);
 
 	/*
 	 * Reset EWMA on utilization increases, the moving average is used only
-- 
2.29.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-05-10  9:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 11:20 [PATCH v2] sched/pelt: Keep UTIL_AVG_UNCHANGED flag in sync when calculating last_enqueued_diff Xuewen Yan
2021-05-07 12:35 ` Vincent Donnefort
2021-05-07 13:36   ` Dietmar Eggemann
2021-05-07 15:38     ` Vincent Donnefort
2021-05-07 16:39       ` Dietmar Eggemann
2021-05-07 17:14         ` Vincent Donnefort
2021-05-08  1:23           ` Xuewen Yan
2021-05-10  9:27             ` Vincent Donnefort

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).