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

From: Peter Zijlstra

Date: Fri Feb 13 2026 - 01:44:47 EST


On Fri, Feb 13, 2026 at 10:52:38AM +0530, K Prateek Nayak wrote:
> On 2/13/2026 1:01 AM, Peter Zijlstra wrote:
> > On Thu, Feb 12, 2026 at 06:24:27PM +0100, Vincent Guittot wrote:
> >
> >>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> >>> index 5b1a2abb727e..de155be02411 100644
> >>> --- a/kernel/sched/fair.c
> >>> +++ b/kernel/sched/fair.c
> >>> @@ -797,7 +797,11 @@ u64 avg_vruntime(struct cfs_rq *cfs_rq)
> >>> if (runtime < 0)
> >>> runtime -= (weight - 1);
> >>>
> >>> +#ifndef CONFIG_64BIT
> >>> delta = div_s64(runtime, weight);
> >>> +#else
> >>> + delta = runtime / weight;
> >>> +#endif
> >>
> >> Good catch
> >>
> >> Don't we have the same problem with the div_s64 in place_entity ?
> >
> > Indeed so. Let me go fix both and push out a new set. I'll post all the
> > patches tomorrow once the robot has blessed them.
>
> rescale_entity() adds a bunch more of those. Don't those need changing
> too? (I'm looking at the current sched/core at b4d41dc4bf30). And a
> wrapper around this pattern would be much appreciated with the amount
> of ifdeffry that gets added

rescale_entity() should be okay, that's just a single entity and not a
weight sum.

As to wrapper, I just went through math64.h and it appears we have
div64_long() that might just DTRT, but I really need to go wake up
first.

And as you noted, the current branch doesn't boot :/ No idea what I
messed up last night, but I did push without test building. I only
folded those two division fixed and figured what could possibly go wrong
:-)

Anyway, let me get the kids to school, have breakfast and I'll go figure
out WTF I messed up.