[PATCH] cpumask: fixlets

From: Rusty Russell
Date: Thu Oct 23 2008 - 17:35:31 EST


[ from Mike ]

Here are the only changes I could find from Rusty's last patches that
apply to tip/cpus4096-v2.

* Fix NR_CPUS reference in arch/powerpc/platforms/cell/spu_base.c

* modify arch/x86/Kconfig so CONFIG_NR_CPUS is always defined. Also it
does not prompt if MAXSMP is set.

* change include/linux/threads.h so CONFIG_NR_CPUS is defined for those
arch's that do not define it.

Signed-of-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Signed-of-by: Mike Travis <travis@xxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
arch/powerpc/platforms/cell/spu_base.c | 9 ++++++---
arch/x86/Kconfig | 2 +-
include/linux/threads.h | 16 ++++++++--------
3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index a5bdb89..a876904 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -111,10 +111,13 @@ void spu_flush_all_slbs(struct mm_struct *mm)
*/
static inline void mm_needs_global_tlbie(struct mm_struct *mm)
{
- int nr = (NR_CPUS > 1) ? NR_CPUS : NR_CPUS + 1;
-
/* Global TLBIE broadcast required with SPEs. */
- __cpus_setall(&mm->cpu_vm_mask, nr);
+ if (NR_CPUS > 1)
+ cpumask_setall(&mm->cpu_vm_mask);
+ else {
+ cpumask_set_cpu(0, &mm->cpu_vm_mask);
+ cpumask_set_cpu(1, &mm->cpu_vm_mask);
+ }
}

void spu_associate_mm(struct spu *spu, struct mm_struct *mm)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d574cd6..a901f59 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -585,9 +585,9 @@ config MAXSMP
If unsure, say N.

config NR_CPUS
- depends on SMP
int "Maximum number of CPUs" if SMP && !MAXSMP
range 2 512 if SMP && !MAXSMP
+ default "1" if !SMP
default "4096" if MAXSMP
default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000
default "8"
diff --git a/include/linux/threads.h b/include/linux/threads.h
index 38d1a5d..052b12b 100644
--- a/include/linux/threads.h
+++ b/include/linux/threads.h
@@ -8,17 +8,17 @@
*/

/*
- * Maximum supported processors that can run under SMP. This value is
- * set via configure setting. The maximum is equal to the size of the
- * bitmasks used on that platform, i.e. 32 or 64. Setting this smaller
- * saves quite a bit of memory.
+ * Maximum supported processors. Setting this smaller saves quite a
+ * bit of memory. Use nr_cpu_ids instead of this except for static bitmaps.
*/
-#ifdef CONFIG_SMP
-#define NR_CPUS CONFIG_NR_CPUS
-#else
-#define NR_CPUS 1
+#ifndef CONFIG_NR_CPUS
+/* FIXME: This should be fixed in the arch's Kconfig */
+#define CONFIG_NR_CPUS 1
#endif

+/* Places which use this should consider cpumask_var_t. */
+#define NR_CPUS CONFIG_NR_CPUS
+
#define MIN_THREADS_LEFT_FOR_ROOT 4

/*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/