aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/topology.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/topology.h')
-rw-r--r--include/asm-x86/topology.h45
1 files changed, 29 insertions, 16 deletions
diff --git a/include/asm-x86/topology.h b/include/asm-x86/topology.h
index 8af05a93f097..22073268b481 100644
--- a/include/asm-x86/topology.h
+++ b/include/asm-x86/topology.h
@@ -32,13 +32,18 @@
32/* Mappings between logical cpu number and node number */ 32/* Mappings between logical cpu number and node number */
33#ifdef CONFIG_X86_32 33#ifdef CONFIG_X86_32
34extern int cpu_to_node_map[]; 34extern int cpu_to_node_map[];
35
36#else 35#else
36/* Returns the number of the current Node. */
37#define numa_node_id() (early_cpu_to_node(raw_smp_processor_id()))
38#endif
39
37DECLARE_PER_CPU(int, x86_cpu_to_node_map); 40DECLARE_PER_CPU(int, x86_cpu_to_node_map);
41
42#ifdef CONFIG_SMP
38extern int x86_cpu_to_node_map_init[]; 43extern int x86_cpu_to_node_map_init[];
39extern void *x86_cpu_to_node_map_early_ptr; 44extern void *x86_cpu_to_node_map_early_ptr;
40/* Returns the number of the current Node. */ 45#else
41#define numa_node_id() (early_cpu_to_node(raw_smp_processor_id())) 46#define x86_cpu_to_node_map_early_ptr NULL
42#endif 47#endif
43 48
44extern cpumask_t node_to_cpumask_map[]; 49extern cpumask_t node_to_cpumask_map[];
@@ -54,6 +59,8 @@ static inline int cpu_to_node(int cpu)
54} 59}
55 60
56#else /* CONFIG_X86_64 */ 61#else /* CONFIG_X86_64 */
62
63#ifdef CONFIG_SMP
57static inline int early_cpu_to_node(int cpu) 64static inline int early_cpu_to_node(int cpu)
58{ 65{
59 int *cpu_to_node_map = x86_cpu_to_node_map_early_ptr; 66 int *cpu_to_node_map = x86_cpu_to_node_map_early_ptr;
@@ -65,22 +72,33 @@ static inline int early_cpu_to_node(int cpu)
65 else 72 else
66 return NUMA_NO_NODE; 73 return NUMA_NO_NODE;
67} 74}
75#else
76#define early_cpu_to_node(cpu) cpu_to_node(cpu)
77#endif
68 78
69static inline int cpu_to_node(int cpu) 79static inline int cpu_to_node(int cpu)
70{ 80{
71#ifdef CONFIG_DEBUG_PER_CPU_MAPS 81#ifdef CONFIG_DEBUG_PER_CPU_MAPS
72 if (x86_cpu_to_node_map_early_ptr) { 82 if (x86_cpu_to_node_map_early_ptr) {
73 printk("KERN_NOTICE cpu_to_node(%d): usage too early!\n", 83 printk("KERN_NOTICE cpu_to_node(%d): usage too early!\n",
74 (int)cpu); 84 (int)cpu);
75 dump_stack(); 85 dump_stack();
76 return ((int *)x86_cpu_to_node_map_early_ptr)[cpu]; 86 return ((int *)x86_cpu_to_node_map_early_ptr)[cpu];
77 } 87 }
78#endif 88#endif
79 if (per_cpu_offset(cpu)) 89 return per_cpu(x86_cpu_to_node_map, cpu);
80 return per_cpu(x86_cpu_to_node_map, cpu);
81 else
82 return NUMA_NO_NODE;
83} 90}
91
92#ifdef CONFIG_NUMA
93
94/* Returns a pointer to the cpumask of CPUs on Node 'node'. */
95#define node_to_cpumask_ptr(v, node) \
96 cpumask_t *v = &(node_to_cpumask_map[node])
97
98#define node_to_cpumask_ptr_next(v, node) \
99 v = &(node_to_cpumask_map[node])
100#endif
101
84#endif /* CONFIG_X86_64 */ 102#endif /* CONFIG_X86_64 */
85 103
86/* 104/*
@@ -129,17 +147,13 @@ extern unsigned long node_remap_size[];
129 147
130# define SD_CACHE_NICE_TRIES 2 148# define SD_CACHE_NICE_TRIES 2
131# define SD_IDLE_IDX 2 149# define SD_IDLE_IDX 2
132# define SD_NEWIDLE_IDX 0 150# define SD_NEWIDLE_IDX 2
133# define SD_FORKEXEC_IDX 1 151# define SD_FORKEXEC_IDX 1
134 152
135#endif 153#endif
136 154
137/* sched_domains SD_NODE_INIT for NUMAQ machines */ 155/* sched_domains SD_NODE_INIT for NUMAQ machines */
138#define SD_NODE_INIT (struct sched_domain) { \ 156#define SD_NODE_INIT (struct sched_domain) { \
139 .span = CPU_MASK_NONE, \
140 .parent = NULL, \
141 .child = NULL, \
142 .groups = NULL, \
143 .min_interval = 8, \ 157 .min_interval = 8, \
144 .max_interval = 32, \ 158 .max_interval = 32, \
145 .busy_factor = 32, \ 159 .busy_factor = 32, \
@@ -157,7 +171,6 @@ extern unsigned long node_remap_size[];
157 | SD_WAKE_BALANCE, \ 171 | SD_WAKE_BALANCE, \
158 .last_balance = jiffies, \ 172 .last_balance = jiffies, \
159 .balance_interval = 1, \ 173 .balance_interval = 1, \
160 .nr_balance_failed = 0, \
161} 174}
162 175
163#ifdef CONFIG_X86_64_ACPI_NUMA 176#ifdef CONFIG_X86_64_ACPI_NUMA
@@ -167,10 +180,10 @@ extern int __node_distance(int, int);
167 180
168#else /* CONFIG_NUMA */ 181#else /* CONFIG_NUMA */
169 182
170#include <asm-generic/topology.h>
171
172#endif 183#endif
173 184
185#include <asm-generic/topology.h>
186
174extern cpumask_t cpu_coregroup_map(int cpu); 187extern cpumask_t cpu_coregroup_map(int cpu);
175 188
176#ifdef ENABLE_TOPO_DEFINES 189#ifdef ENABLE_TOPO_DEFINES