Re: [PATCH] sched/fair: Fix forked task check in vruntime_normalized

From: John Stultz
Date: Mon Apr 01 2024 - 14:09:28 EST


On Mon, Apr 1, 2024 at 8:20 AM Honglei Wang <jameshongleiwang@xxxxxxx> wrote:
> On 2024/3/28 14:27, mingyang.cui wrote:
> > When rt_mutex_setprio changes a task's scheduling class to RT,
> > sometimes the task's vruntime is not updated correctly upon
> > return to the fair class.
> > Specifically, the following is being observed:
> > - task has just been created and running for a short time
> > - task sleep while still in the fair class
> > - task is boosted to RT via rt_mutex_setprio, which changes
> > the task to RT and calls check_class_changed.
> > - check_class_changed leads to detach_task_cfs_rq, at which point
> > the vruntime_normalized check sees that the task's sum_exec_runtime
> > is zero, which results in skipping the subtraction of the
> > rq's min_vruntime from the task's vruntime
>
> Did you do the test on the latest tree? vruntime_normalized was removed
> by e8f331bcc2 (sched/smp: Use lag to simplify cross-runqueue placement).

Indeed (I was looking at an older tree last week and missed it was
removed as well). Though something like this change probably will be
needed for the -stable trees?

thanks
-john