[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260211162825.GZ1282955@noisy.programming.kicks-ass.net>
Date: Wed, 11 Feb 2026 17:28:25 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Vincent Guittot <vincent.guittot@...aro.org>
Cc: Doug Smythies <dsmythies@...us.net>,
K Prateek Nayak <kprateek.nayak@....com>, mingo@...nel.org,
juri.lelli@...hat.com, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
vschneid@...hat.com, linux-kernel@...r.kernel.org,
wangtao554@...wei.com, quzicheng@...wei.com,
wuyun.abel@...edance.com
Subject: Re: [PATCH 0/4] sched: Various reweight_entity() fixes
On Wed, Feb 11, 2026 at 12:15:48PM +0100, Vincent Guittot wrote:
> Regarding the use of calc_delta_fair() in update_entity_lag(), we use
> calc_delta_fair() for updating vruntime, deadline, vprot and vlag and
> I wonder how this diff of granularity compared to avg_vruntime can be
> an issue for sched_entity with a small weight
It will effectively inflate their weight.
The below seems to 'work' -- it builds, boots and builds a kernel.
We could perhaps look at doing that reciprocal thing on unsigned long,
but meh.
---
Subject: sched/fair: Use full weight to __calc_delta()
From: Peter Zijlstra <peterz@...radead.org>
Date: Wed Feb 11 17:07:58 CET 2026
Since we now use the full weight for avg_vruntime(), also make
__calc_delta() use the full value.
Since weight is effectively NICE_0_LOAD, this is 20 bits on 64bit.
This leaves 44 bits for delta_exec, which is ~16k seconds, way longer
than any one tick would ever be, so no worry about overflow.
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
---
kernel/sched/fair.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -259,6 +259,7 @@ static void __update_inv_weight(struct l
*/
static u64 __calc_delta(u64 delta_exec, unsigned long weight, struct load_weight *lw)
{
+#ifdef CONFIG_32BIT
u64 fact = scale_load_down(weight);
u32 fact_hi = (u32)(fact >> 32);
int shift = WMULT_SHIFT;
@@ -282,6 +283,9 @@ static u64 __calc_delta(u64 delta_exec,
}
return mul_u64_u32_shr(delta_exec, fact, shift);
+#else
+ return (delta_exec * weight) / lw->weight;
+#endif
}
/*
Powered by blists - more mailing lists