On 09/10/20 13:42, Aubrey Li wrote:
> Added idle cpumask to track idle cpus in sched domain. When a CPU
> enters idle, its corresponding bit in the idle cpumask will be set,
> and when the CPU exits idle, its bit will be cleared.
> 
> When a task wakes up to select an idle cpu, scanning idle cpumask
> has low cost than scanning all the cpus in last level cache domain,
> especially when the system is heavily loaded.
> 
> Signed-off-by: Aubrey Li <aubrey...@linux.intel.com>
> ---
>  include/linux/sched/topology.h | 13 +++++++++++++
>  kernel/sched/fair.c            |  4 +++-
>  kernel/sched/topology.c        |  2 +-
>  3 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
> index fb11091129b3..43a641d26154 100644
> --- a/include/linux/sched/topology.h
> +++ b/include/linux/sched/topology.h
> @@ -65,8 +65,21 @@ struct sched_domain_shared {
>       atomic_t        ref;
>       atomic_t        nr_busy_cpus;
>       int             has_idle_cores;
> +     /*
> +      * Span of all idle CPUs in this domain.
> +      *
> +      * NOTE: this field is variable length. (Allocated dynamically
> +      * by attaching extra space to the end of the structure,
> +      * depending on how many CPUs the kernel has booted up with)
> +      */
> +     unsigned long   idle_cpus_span[];

Can't you use cpumask_var_t and zalloc_cpumask_var() instead?

The patch looks useful. Did it help you with any particular workload? It'd be
good to expand on that in the commit message.

Thanks

--
Qais Yousef

Reply via email to