Re: [RFC PATCH 0/1] sched/pelt: Change PELT halflife at runtime

From: Vincent Guittot
Date: Wed Mar 01 2023 - 05:24:52 EST


On Wed, 22 Feb 2023 at 21:29, Dietmar Eggemann <dietmar.eggemann@xxxxxxx> wrote:
>
> On 21/02/2023 10:29, Vincent Guittot wrote:
> > On Mon, 20 Feb 2023 at 14:54, Vincent Guittot
> > <vincent.guittot@xxxxxxxxxx> wrote:
> >>
> >> On Fri, 17 Feb 2023 at 14:54, Dietmar Eggemann <dietmar.eggemann@xxxxxxx> wrote:
> >>>
> >>> On 09/02/2023 17:16, Vincent Guittot wrote:
> >>>> On Tue, 7 Feb 2023 at 11:29, Dietmar Eggemann <dietmar.eggemann@xxxxxxx> wrote:
> >>>>>
> >>>>> On 09/11/2022 16:49, Peter Zijlstra wrote:
> >>>>>> On Tue, Nov 08, 2022 at 07:48:43PM +0000, Qais Yousef wrote:
> >>>>>>> On 11/07/22 14:41, Peter Zijlstra wrote:
> >>>>>>>> On Thu, Sep 29, 2022 at 03:41:47PM +0100, Kajetan Puchalski wrote:
>
> [...]
>
> >>> I ran the same test (boosting only for DVFS requests) with:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ *
> >>>
> >>> -->8--
> >>>
> >>> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> >>> index dbc56e8b85f9..7a4bf38f2920 100644
> >>> --- a/kernel/sched/sched.h
> >>> +++ b/kernel/sched/sched.h
> >>> @@ -2946,6 +2946,8 @@ static inline unsigned long cpu_util_cfs(int cpu)
> >>> READ_ONCE(cfs_rq->avg.util_est.enqueued));
> >>> }
> >>>
> >>> + util = max(util, READ_ONCE(cfs_rq->avg.runnable_avg));
> >>> +
> >
> > Another reason why it gives better results could be that
> > cpu_util_cfs() is not only used for DVFS selection but also to track
> > the cpu utilization in load balance and EAS so the cpu will be faster
> > seen as overloaded and tasks will be spread around when there are
> > contentions.
> >
> > Could you try to take cfs_rq->avg.runnable_avg into account only when
> > selecting frequency ?
>
> I actually did exactly this. (* but not shown in the code snippet).
> I just used the boosting for CPU frequency selection (from
> sugov_get_util()). I added the the `_freq` suffix in the kernel name to
> indicate this.

Ok. So the improvement that you are seeing, is really related to
better freq selection

>
> > That being said I can see some place in load balance where
> > cfs_rq->avg.runnable_avg could give some benefits like in
> > find_busiest_queue() where it could be better to take into account the
> > contention when selecting the busiest queue
>
> Could be. Looks like so far we only use it in group_has_capacity(),
> group_is_overloaded() and for NUMA.

I think it could be interesting to use runnable_avg in
find_busiest_queue() for migrate_util case to select the rq with
highest contention as an example

>
> [...]