Re: [PATCH V2 1/8] MIPS: Support hard limit of cpu count (nr_cpu_ids)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 13, 2014 at 08:24:15AM +0800, Huacai Chen wrote:
> On MIPS currently, only the soft limit of cpu count (maxcpus) has its
> effect, this patch enable the hard limit (nr_cpus) as well. Processor
> cores which greater than maxcpus and less than nr_cpus can be taken up
> via cpu hotplug. The code is borrowed from X86.
> 
> Signed-off-by: Huacai Chen <chenhc@xxxxxxxxxx>

Reviewed-by: Andreas Herrmann <andreas.herrmann@xxxxxxxxxxxxxxxxxx>

W/o this patch nr_cpus had no effect and all CPUs present on a chip
(even if greater than or equal to nr_cpus) could be taken online with
CPU hotplug.  W/o the patch nr_cpus took effect.

Only nitpick: I find the name of the function somehow misleading.
I think it's rather a kind of fixup (to factor in nr_cpus) after
platform smp_setup might have already "prefilled"
cpu_possible_mask. At least in case of cavium-octeon this is the case.


Thanks,
Andreas

> ---
>  arch/mips/kernel/setup.c |   20 ++++++++++++++++++++
>  1 files changed, 20 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
> index a842154..2f01201 100644
> --- a/arch/mips/kernel/setup.c
> +++ b/arch/mips/kernel/setup.c
> @@ -729,6 +729,25 @@ static void __init resource_init(void)
>  	}
>  }
>  
> +#ifdef CONFIG_SMP
> +static void __init prefill_possible_map(void)
> +{
> +	int i, possible = num_possible_cpus();
> +
> +	if (possible > nr_cpu_ids)
> +		possible = nr_cpu_ids;
> +
> +	for (i = 0; i < possible; i++)
> +		set_cpu_possible(i, true);
> +	for (; i < NR_CPUS; i++)
> +		set_cpu_possible(i, false);
> +
> +	nr_cpu_ids = possible;
> +}
> +#else
> +static inline void prefill_possible_map(void) {}
> +#endif
> +
>  void __init setup_arch(char **cmdline_p)
>  {
>  	cpu_probe();
> @@ -752,6 +771,7 @@ void __init setup_arch(char **cmdline_p)
>  
>  	resource_init();
>  	plat_smp_setup();
> +	prefill_possible_map();
>  
>  	cpu_cache_init();
>  }
> -- 
> 1.7.7.3
> 
> 


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux