Re: [PATCH] Fix isocpus's param handling when CPUMASK_OFFSTACK=n.

From: Ingo Molnar
Date: Fri Oct 20 2017 - 04:49:51 EST



* Rakib Mullick <rakib.mullick@xxxxxxxxx> wrote:

> cpulist_parse() uses nr_cpumask_bits as limit to parse the
> passed buffer from kernel commandline. What nr_cpumask_bits
> represents varies depends upon CONFIG_CPUMASK_OFFSTACK option.
> If CONFIG_CPUMASK_OFFSTACK=n, then nr_cpumask_bits is same as
> NR_CPUS, which might not represent the # of cpus really exist
> (default 64). So, there's a chance of gap between nr_cpu_ids
> and NR_CPUS, which ultimately lead towards invalid cpulist_parse()
> operation. For example, if isolcpus=9 is passed on a 8 cpu
> system (CONFIG_CPUMASK_OFFSTACK=n) it doesn't show the error
> that it suppose to.
>
> This patch fixes this issue by effectively find out the last
> cpu of the passed isolcpus list and checking it with nr_cpu_ids.
> Also, fixes the error message where the nr_cpu_ids should be
> nr_cpu_ids-1, since the cpu numbering starts from 0.
>
> Signed-off-by: Rakib Mullick <rakib.mullick@xxxxxxxxx>
> ---
> include/linux/cpumask.h | 16 ++++++++++++++++
> kernel/sched/topology.c | 8 +++++---
> 2 files changed, 21 insertions(+), 3 deletions(-)

What kernel is this against? It does not apply to the latest kernels.

Thanks,

Ingo