Re: [PATCH 04/10] sched/fair: Dynamically update cfs_overload_cpus

From: Peter Zijlstra
Date: Mon Oct 22 2018 - 13:07:04 EST


On Mon, Oct 22, 2018 at 07:59:35AM -0700, Steve Sistare wrote:
> An overloaded CPU has more than 1 runnable task. When a CFS task wakes
> on a CPU, if h_nr_running transitions from 1 to more, then set the CPU in
> the cfs_overload_cpus bitmap. When a CFS task sleeps, if h_nr_running
> transitions from 2 to less, then clear the CPU in cfs_overload_cpus.

> @@ -5111,8 +5147,12 @@ static inline void hrtick_update(struct rq *rq)
> update_cfs_group(se);
> }
>
> - if (!se)
> + if (!se) {
> add_nr_running(rq, 1);
> + if (prev_nr == 1)
> + overload_set(rq);
> +
> + }

This is very similar to what RT already has, except they also track if
the tasks in question is in fact migratable (p->nr_cpus_allowed > 1).

And similarly, it might make sense to use the sparse mask thing over
there.