]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
cpumask: add CPU_MASK_ALL_PTR macro
authorMike Travis <travis@sgi.com>
Sat, 5 Apr 2008 01:11:02 +0000 (18:11 -0700)
committerIngo Molnar <mingo@elte.hu>
Sat, 19 Apr 2008 17:44:59 +0000 (19:44 +0200)
  * Add a static cpumask_t variable "CPU_MASK_ALL_PTR" to use as
    a pointer reference to CPU_MASK_ALL.  This reduces where possible
    the instances where CPU_MASK_ALL allocates and fills a large
    array on the stack.  Used only if NR_CPUS > BITS_PER_LONG.

  * Change init/main.c to use new set_cpus_allowed_ptr().

Depends on:
[sched-devel]: sched: add new set_cpus_allowed_ptr function

Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/cpumask.h
init/main.c

index 67e0e38d32b158fdb552939cebc8944ee0338230..629102feaa663f05eb4b696682e49a24e8366ef8 100644 (file)
@@ -243,6 +243,8 @@ int __next_cpu(int n, const cpumask_t *srcp);
        [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD                 \
 } }
 
+#define CPU_MASK_ALL_PTR       (&CPU_MASK_ALL)
+
 #else
 
 #define CPU_MASK_ALL                                                   \
@@ -251,6 +253,10 @@ int __next_cpu(int n, const cpumask_t *srcp);
        [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD                 \
 } }
 
+/* cpu_mask_all is in init/main.c */
+extern cpumask_t cpu_mask_all;
+#define CPU_MASK_ALL_PTR       (&cpu_mask_all)
+
 #endif
 
 #define CPU_MASK_NONE                                                  \
index 99ce94930b09302f7af89f75c07d7daa6a7ef668..2df3f0617fdc89fe8377d5d76fb9214c1e8f79a8 100644 (file)
@@ -363,6 +363,11 @@ static inline void smp_prepare_cpus(unsigned int maxcpus) { }
 
 #else
 
+#if NR_CPUS > BITS_PER_LONG
+cpumask_t cpu_mask_all __read_mostly = CPU_MASK_ALL;
+EXPORT_SYMBOL(cpu_mask_all);
+#endif
+
 #ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
 unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
 
@@ -811,7 +816,7 @@ static int __init kernel_init(void * unused)
        /*
         * init can run on any cpu.
         */
-       set_cpus_allowed(current, CPU_MASK_ALL);
+       set_cpus_allowed_ptr(current, CPU_MASK_ALL_PTR);
        /*
         * Tell the world that we're going to be the grim
         * reaper of innocent orphaned children.