diff options
| author | Andrew Morton <akpm@osdl.org> | 2004-06-23 18:50:29 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-06-23 18:50:29 -0700 |
| commit | d2cec97bc421d6f9c2ee0d9bd8e0ce47d0022cac (patch) | |
| tree | 527641d4a33f472af4e9b233f65108e7cf0a96d1 /include/linux/cpumask.h | |
| parent | 8c1ce9d6d628945ff23f844dbe9f21f5d5383b99 (diff) | |
[PATCH] cpumask: make cpu_present_map real even on non-smp
From: Paul Jackson <pj@sgi.com>
This patch makes cpu_present_map a real map for all configurations, instead of
a constant for non-SMP. It also moves the definition of cpu_present_map out
of kernel/cpu.c into kernel/sched.c, because cpu.c isn't compiled into non-SMP
kernels.
The pattern is that each of the possible, present and online cpu maps are
actual kernel global cpumask_t variables, for all configurations. They are
documented in include/linux/cpumask.h. Some of the UP (NR_CPUS=1) code
cheats, and hardcodes the assumption that the single bit position of these
maps is always set, as an optimization.
Signed-off-by: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/cpumask.h')
| -rw-r--r-- | include/linux/cpumask.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 4293a465d87b..dced3ec2b0c8 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -10,15 +10,12 @@ extern cpumask_t cpu_online_map; extern cpumask_t cpu_possible_map; -extern cpumask_t cpu_present_map; #define num_online_cpus() cpus_weight(cpu_online_map) #define num_possible_cpus() cpus_weight(cpu_possible_map) -#define num_present_cpus() cpus_weight(cpu_present_map) #define cpu_online(cpu) cpu_isset(cpu, cpu_online_map) #define cpu_possible(cpu) cpu_isset(cpu, cpu_possible_map) -#define cpu_present(cpu) cpu_isset(cpu, cpu_present_map) #define for_each_cpu_mask(cpu, mask) \ for (cpu = first_cpu_const(mk_cpumask_const(mask)); \ @@ -27,26 +24,26 @@ extern cpumask_t cpu_present_map; #define for_each_cpu(cpu) for_each_cpu_mask(cpu, cpu_possible_map) #define for_each_online_cpu(cpu) for_each_cpu_mask(cpu, cpu_online_map) -#define for_each_present_cpu(cpu) for_each_cpu_mask(cpu, cpu_present_map) #else #define cpu_online_map cpumask_of_cpu(0) #define cpu_possible_map cpumask_of_cpu(0) -#define cpu_present_map cpumask_of_cpu(0) #define num_online_cpus() 1 #define num_possible_cpus() 1 -#define num_present_cpus() 1 #define cpu_online(cpu) ({ BUG_ON((cpu) != 0); 1; }) #define cpu_possible(cpu) ({ BUG_ON((cpu) != 0); 1; }) -#define cpu_present(cpu) ({ BUG_ON((cpu) != 0); 1; }) #define for_each_cpu_mask(cpu, mask) for (cpu = 0; cpu < 1; cpu++) #define for_each_cpu(cpu) for (cpu = 0; cpu < 1; cpu++) #define for_each_online_cpu(cpu) for (cpu = 0; cpu < 1; cpu++) -#define for_each_present_cpu(cpu) for (cpu = 0; cpu < 1; cpu++) #endif +extern cpumask_t cpu_present_map; +#define num_present_cpus() cpus_weight(cpu_present_map) +#define cpu_present(cpu) cpu_isset(cpu, cpu_present_map) +#define for_each_present_cpu(cpu) for_each_cpu_mask(cpu, cpu_present_map) + #define cpumask_scnprintf(buf, buflen, map) \ bitmap_scnprintf(buf, buflen, cpus_addr(map), NR_CPUS) |
