Re: [PATCH v2] sched_ext: Rebuild fair weight on ext to fair switches

From: Peter Zijlstra

Date: Thu May 28 2026 - 05:30:21 EST


On Thu, May 28, 2026 at 10:53:54AM +0800, Zicheng Qu wrote:

> 2. Rebuilding `p->se.load` from fair's `switching_to` hook. This is the most
> natural place semantically, since the task is entering fair and fair
> prepares
> its own state before enqueue. My only concern was that, for non-ext -> fair
> paths, `__setscheduler_params()` may have already updated `p->se.load`
> through
> `set_load_weight(p, true)`, so calling `set_load_weight(p, false)`
> unconditionally here can be redundant logically. Functionally, though, it is
> harmless.

Right. We can worry about optimizing this if there's ever a report. I
don't expect this to be noticeable much. If anything, the PI code would
be the one to trip this most often I think.