Skip to content

cpumask: cleanup nr_cpu_ids vs nr_cpumask_bits mess

Yury Norov linux-riscv lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 25 repliesIn review
  2. v14 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- don't declare nr_cpu_ids if NR_CPUS == 1;
- move set_nr_cpu_ids() from smp.h to cpumask.h to avoid errors in some
inclusion paths;
- drop 'default n' in FORCE_NR_CPUS option description;
- rebase on top of v6.0-rc4.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5smp: don't declare nr_cpu_ids if NR_CPUS == 1kernel/smp.c+2 -07 replies
2/5smp: add set_nr_cpu_ids()arch/loongarch/kernel/setup.c arch/mips/kernel/setup.c arch/x86/kernel/smpboot.c +3 more+12 -70 replies
3/5lib/cpumask: delete misleading commentinclude/linux/cpumask.h+0 -40 replies
4/5lib/cpumask: deprecate nr_cpumask_bitsinclude/linux/cpumask.h+1 -60 replies
5/5lib/cpumask: add FORCE_NR_CPUS config optioninclude/linux/cpumask.h kernel/smp.c lib/Kconfig+17 -410 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/5] cpumask: cleanup nr_cpu_ids vs nr_cpumask_bits mess

cpumask subsystem uses nr_cpu_ids and nr_cpumask_bits interchangeably despite that the variables have different meaning and purpose. It makes some cpumask functions broken.

This series cleans that mess and adds new config FORCE_NR_CPUS that allows to optimize cpumask subsystem if the number of CPUs is known at compile-time.

After some testing I found build broken when SMP is on and NR_CPUS == 1. This is addressed in a new patch #1, and in the following patch #2 that now declares set_nr_cpu_ids in cpumask.h (was in smp.h).

v1: https://lore.kernel.org/lkml/[email protected]/T/#mecbd787f8d1bff1454a4ec2fe46ad6dc168df695
v2:
- don't declare nr_cpu_ids if NR_CPUS == 1;
- move set_nr_cpu_ids() from smp.h to cpumask.h to avoid errors in some
inclusion paths;
- drop 'default n' in FORCE_NR_CPUS option description;
- rebase on top of v6.0-rc4.

Yury Norov (5):
smp: don't declare nr_cpu_ids if NR_CPUS == 1
smp: add set_nr_cpu_ids()
lib/cpumask: delete misleading comment
lib/cpumask: deprecate nr_cpumask_bits
lib/cpumask: add FORCE_NR_CPUS config option

 arch/loongarch/kernel/setup.c |  2 +-
 arch/mips/kernel/setup.c      |  2 +-
 arch/x86/kernel/smpboot.c     |  4 ++--
 arch/x86/xen/smp_pv.c         |  2 +-
 include/linux/cpumask.h       | 22 +++++++++++-----------
 kernel/smp.c                  |  6 ++++--
 lib/Kconfig                   |  9 +++++++++
 7 files changed, 29 insertions(+), 18 deletions(-)
Signature · 1 line
2.34.1