Re: [PATCH v3] sched/pelt: Use rq_clock_task() for hw_pressure

From: Chen Yu
Date: Mon Aug 05 2024 - 09:58:04 EST


On 2024-08-05 at 12:56:09 +0200, Vincent Guittot wrote:
> Sorry for the late reply on this
>
> On Mon, 29 Jul 2024 at 09:05, Chen Yu <yu.c.chen@xxxxxxxxx> wrote:
> >
> > commit 97450eb90965 ("sched/pelt: Remove shift of thermal clock")
> > removed the decay_shift for hw_pressure. This commit uses the
> > sched_clock_task() in sched_tick() while it replaces the
> > sched_clock_task() with rq_clock_pelt() in __update_blocked_others().
>
> Good catch, it should be sched_clock_task() everywhere
>
> > This could bring inconsistence. One possible scenario I can think of
> > is in ___update_load_sum():
> >
> > u64 delta = now - sa->last_update_time
> >
> > 'now' could be calculated by rq_clock_pelt() from
> > __update_blocked_others(), and last_update_time was calculated by
> > rq_clock_task() previously from sched_tick(). Usually the former
> > chases after the latter, it cause a very large 'delta' and brings
> > unexpected behavior.
> >
> > Fix this by using rq_clock_task() inside update_hw_load_avg(),
> > because:
>
> No, don't call the rq_clock_task() inside update_hw_load_avg(), keep
> it outside. V2 was the correct solution
> Nack for this v3. Please come back on v2

OK, thanks for taking a look, I'll refine v2 and send v4 out.

thanks,
Chenyu