Re: [PATCH] sched/fair: Rate limit calls to update_blocked_averages() for NOHZ

Tim Chen
2021-03-24T16:06:31Z

On 3/24/21 6:44 AM, Vincent Guittot wrote:
> Hi Tim,

>
> IIUC your problem, we call update_blocked_averages() but because of:
>
> if (this_rq->avg_idle < curr_cost + sd->max_newidle_lb_cost) {
> update_next_balance(sd, &next_balance);
> break;
> }
>
> the for_each_domain loop stops even before running load_balance on the 1st
> sched domain level which means that update_blocked_averages() was called
> unnecessarily.
>

That's right

> And this is even more true with a small sysctl_sched_migration_cost which allows newly
> idle LB for very small this_rq->avg_idle. We could wonder why you set such a low value
> for sysctl_sched_migration_cost which is lower than the max_newidle_lb_cost of the
> smallest domain but that's probably because of task_hot().
>
> if avg_idle is lower than the sd->max_newidle_lb_cost of the 1st sched_domain, we should
> skip spin_unlock/lock and for_each_domain() loop entirely
>
> Maybe something like below:
>

The patch makes sense. I'll ask our benchmark team to queue this patch for testing.

Tim