Re: [PATCH 0/4] sched: Various reweight_entity() fixes

From: Peter Zijlstra

Date: Wed Feb 11 2026 - 11:28:50 EST


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@xxxxxxxxxxxxx>
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@xxxxxxxxxxxxx>
---
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
}

/*