Re: [PATCH] sched/fair: Optimize select_idle_cpu

From: Peter Zijlstra
Date: Fri Dec 13 2019 - 03:10:54 EST

On Fri, Dec 13, 2019 at 09:51:30AM +0800, chengjian (D) wrote:
> Hi, Peter
>     I saw the same work in select_idle_core, and I was wondering why the
> per_cpu variable was
> needed for this yesterday. Now I think I probably understand : cpumask may
> be too large,
> putting it on the stack may cause overflow. Is this correct ?

Yes, for instance when NR_CPUS=4096, struct cpumask ends up being 512
bytes, and that is _far_ too large for an on-stack variable, remember we
have relatively small fixed size stacks.