aa6b54461c
Create a simple macro to always return a pointer to the node_to_cpumask(node) value. This relies on compiler optimization to remove the extra indirection: #define node_to_cpumask_ptr(v, node) \ cpumask_t _##v = node_to_cpumask(node), *v = &_##v For those systems with a large cpumask size, then a true pointer to the array element can be used: #define node_to_cpumask_ptr(v, node) \ cpumask_t *v = &(node_to_cpumask_map[node]) A node_to_cpumask_ptr_next() macro is provided to access another node_to_cpumask value. The other change is to always include asm-generic/topology.h moving the ifdef CONFIG_NUMA to this same file. Note: there are no references to either of these new macros in this patch, only the definition. Based on 2.6.25-rc5-mm1 # alpha Cc: Richard Henderson <rth@twiddle.net> # fujitsu Cc: David Howells <dhowells@redhat.com> # ia64 Cc: Tony Luck <tony.luck@intel.com> # powerpc Cc: Paul Mackerras <paulus@samba.org> Cc: Anton Blanchard <anton@samba.org> # sparc Cc: David S. Miller <davem@davemloft.net> Cc: William L. Irwin <wli@holomorphy.com> # x86 Cc: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Mike Travis <travis@sgi.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
47 lines
811 B
C
47 lines
811 B
C
#ifndef _ASM_ALPHA_TOPOLOGY_H
|
|
#define _ASM_ALPHA_TOPOLOGY_H
|
|
|
|
#include <linux/smp.h>
|
|
#include <linux/threads.h>
|
|
#include <asm/machvec.h>
|
|
|
|
#ifdef CONFIG_NUMA
|
|
static inline int cpu_to_node(int cpu)
|
|
{
|
|
int node;
|
|
|
|
if (!alpha_mv.cpuid_to_nid)
|
|
return 0;
|
|
|
|
node = alpha_mv.cpuid_to_nid(cpu);
|
|
|
|
#ifdef DEBUG_NUMA
|
|
BUG_ON(node < 0);
|
|
#endif
|
|
|
|
return node;
|
|
}
|
|
|
|
static inline cpumask_t node_to_cpumask(int node)
|
|
{
|
|
cpumask_t node_cpu_mask = CPU_MASK_NONE;
|
|
int cpu;
|
|
|
|
for_each_online_cpu(cpu) {
|
|
if (cpu_to_node(cpu) == node)
|
|
cpu_set(cpu, node_cpu_mask);
|
|
}
|
|
|
|
#ifdef DEBUG_NUMA
|
|
printk("node %d: cpu_mask: %016lx\n", node, node_cpu_mask);
|
|
#endif
|
|
|
|
return node_cpu_mask;
|
|
}
|
|
|
|
#define pcibus_to_cpumask(bus) (cpu_online_map)
|
|
|
|
#endif /* !CONFIG_NUMA */
|
|
# include <asm-generic/topology.h>
|
|
|
|
#endif /* _ASM_ALPHA_TOPOLOGY_H */
|