Re: [PATCH v3 4/5] sched/fair: Remove sysctl_sched_migration_cost condition
From: Vincent Guittot
Date: Fri Oct 29 2021 - 08:30:51 EST
On Fri, 29 Oct 2021 at 12:02, Dietmar Eggemann <dietmar.eggemann@xxxxxxx> wrote:
>
> On 19/10/2021 14:35, Vincent Guittot wrote:
> > With a default value of 500us, sysctl_sched_migration_cost is
> > significanlty higher than the cost of load_balance. Remove the
>
> Shouldn't this be rather `load balance cost on the lowest sd`? I assume
> here that lb cost stands for sd->max_newidle_lb_cost of the 1st sd.
Both.
During the tests, I did on thx2, the sum of sd->max_newidle_lb_cost
could range between 18us and 829us.
During those tests, I had a limited number of cgroup and the
update_blocked_average could certainly go above the 273us of SMT
sd->max_newidle_lb_cost and the 500us of sysctl_sched_migration_cost
>
> We still use sysctl_sched_migration_cost as a floor against max_cost
> (i.e. lb cost of all sd's) when setting rq->max_idle_balance_cost in
> rebalance_domains().
rq->max_idle_balance_cost is used to cap the value used to compute rq->avg_idle.
>
> And in the add-on discussion (disabling the call to
> nohz_newidle_balance() you mention that sd->max_newidle_lb_cost can be
> higher than sysctl_sched_migration_cost (even when default 500us).
yes, I have reached 273us on thx2 with 2 empty cgroups
>
>
> > condition and rely on the sd->max_newidle_lb_cost to abort
> > newidle_balance.
> >
> > Suggested-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> > Signed-off-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
> > ---
> > kernel/sched/fair.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index e50fd751e1df..57eae0ebc492 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -10895,8 +10895,7 @@ static int newidle_balance(struct rq *this_rq, struct rq_flags *rf)
> > rcu_read_lock();
> > sd = rcu_dereference_check_sched_domain(this_rq->sd);
> >
> > - if (this_rq->avg_idle < sysctl_sched_migration_cost ||
> > - !READ_ONCE(this_rq->rd->overload) ||
> > + if (!READ_ONCE(this_rq->rd->overload) ||
> > (sd && this_rq->avg_idle < sd->max_newidle_lb_cost)) {
> >
> > if (sd)
> >
>