diff options
Diffstat (limited to 'arch/x86/include/asm/topology.h')
-rw-r--r-- | arch/x86/include/asm/topology.h | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 79e31e9dcdda..4e2f2e0aab27 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h | |||
@@ -61,13 +61,19 @@ static inline int cpu_to_node(int cpu) | |||
61 | * | 61 | * |
62 | * Side note: this function creates the returned cpumask on the stack | 62 | * Side note: this function creates the returned cpumask on the stack |
63 | * so with a high NR_CPUS count, excessive stack space is used. The | 63 | * so with a high NR_CPUS count, excessive stack space is used. The |
64 | * node_to_cpumask_ptr function should be used whenever possible. | 64 | * cpumask_of_node function should be used whenever possible. |
65 | */ | 65 | */ |
66 | static inline cpumask_t node_to_cpumask(int node) | 66 | static inline cpumask_t node_to_cpumask(int node) |
67 | { | 67 | { |
68 | return node_to_cpumask_map[node]; | 68 | return node_to_cpumask_map[node]; |
69 | } | 69 | } |
70 | 70 | ||
71 | /* Returns a bitmask of CPUs on Node 'node'. */ | ||
72 | static inline const struct cpumask *cpumask_of_node(int node) | ||
73 | { | ||
74 | return &node_to_cpumask_map[node]; | ||
75 | } | ||
76 | |||
71 | #else /* CONFIG_X86_64 */ | 77 | #else /* CONFIG_X86_64 */ |
72 | 78 | ||
73 | /* Mappings between node number and cpus on that node. */ | 79 | /* Mappings between node number and cpus on that node. */ |
@@ -82,7 +88,7 @@ DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); | |||
82 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | 88 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS |
83 | extern int cpu_to_node(int cpu); | 89 | extern int cpu_to_node(int cpu); |
84 | extern int early_cpu_to_node(int cpu); | 90 | extern int early_cpu_to_node(int cpu); |
85 | extern const cpumask_t *_node_to_cpumask_ptr(int node); | 91 | extern const cpumask_t *cpumask_of_node(int node); |
86 | extern cpumask_t node_to_cpumask(int node); | 92 | extern cpumask_t node_to_cpumask(int node); |
87 | 93 | ||
88 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ | 94 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
@@ -103,7 +109,7 @@ static inline int early_cpu_to_node(int cpu) | |||
103 | } | 109 | } |
104 | 110 | ||
105 | /* Returns a pointer to the cpumask of CPUs on Node 'node'. */ | 111 | /* Returns a pointer to the cpumask of CPUs on Node 'node'. */ |
106 | static inline const cpumask_t *_node_to_cpumask_ptr(int node) | 112 | static inline const cpumask_t *cpumask_of_node(int node) |
107 | { | 113 | { |
108 | return &node_to_cpumask_map[node]; | 114 | return &node_to_cpumask_map[node]; |
109 | } | 115 | } |
@@ -116,12 +122,15 @@ static inline cpumask_t node_to_cpumask(int node) | |||
116 | 122 | ||
117 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ | 123 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
118 | 124 | ||
119 | /* Replace default node_to_cpumask_ptr with optimized version */ | 125 | /* |
126 | * Replace default node_to_cpumask_ptr with optimized version | ||
127 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" | ||
128 | */ | ||
120 | #define node_to_cpumask_ptr(v, node) \ | 129 | #define node_to_cpumask_ptr(v, node) \ |
121 | const cpumask_t *v = _node_to_cpumask_ptr(node) | 130 | const cpumask_t *v = cpumask_of_node(node) |
122 | 131 | ||
123 | #define node_to_cpumask_ptr_next(v, node) \ | 132 | #define node_to_cpumask_ptr_next(v, node) \ |
124 | v = _node_to_cpumask_ptr(node) | 133 | v = cpumask_of_node(node) |
125 | 134 | ||
126 | #endif /* CONFIG_X86_64 */ | 135 | #endif /* CONFIG_X86_64 */ |
127 | 136 | ||
@@ -187,7 +196,7 @@ extern int __node_distance(int, int); | |||
187 | #define cpu_to_node(cpu) 0 | 196 | #define cpu_to_node(cpu) 0 |
188 | #define early_cpu_to_node(cpu) 0 | 197 | #define early_cpu_to_node(cpu) 0 |
189 | 198 | ||
190 | static inline const cpumask_t *_node_to_cpumask_ptr(int node) | 199 | static inline const cpumask_t *cpumask_of_node(int node) |
191 | { | 200 | { |
192 | return &cpu_online_map; | 201 | return &cpu_online_map; |
193 | } | 202 | } |
@@ -200,12 +209,15 @@ static inline int node_to_first_cpu(int node) | |||
200 | return first_cpu(cpu_online_map); | 209 | return first_cpu(cpu_online_map); |
201 | } | 210 | } |
202 | 211 | ||
203 | /* Replace default node_to_cpumask_ptr with optimized version */ | 212 | /* |
213 | * Replace default node_to_cpumask_ptr with optimized version | ||
214 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" | ||
215 | */ | ||
204 | #define node_to_cpumask_ptr(v, node) \ | 216 | #define node_to_cpumask_ptr(v, node) \ |
205 | const cpumask_t *v = _node_to_cpumask_ptr(node) | 217 | const cpumask_t *v = cpumask_of_node(node) |
206 | 218 | ||
207 | #define node_to_cpumask_ptr_next(v, node) \ | 219 | #define node_to_cpumask_ptr_next(v, node) \ |
208 | v = _node_to_cpumask_ptr(node) | 220 | v = cpumask_of_node(node) |
209 | #endif | 221 | #endif |
210 | 222 | ||
211 | #include <asm-generic/topology.h> | 223 | #include <asm-generic/topology.h> |
@@ -214,12 +226,12 @@ static inline int node_to_first_cpu(int node) | |||
214 | /* Returns the number of the first CPU on Node 'node'. */ | 226 | /* Returns the number of the first CPU on Node 'node'. */ |
215 | static inline int node_to_first_cpu(int node) | 227 | static inline int node_to_first_cpu(int node) |
216 | { | 228 | { |
217 | node_to_cpumask_ptr(mask, node); | 229 | return cpumask_first(cpumask_of_node(node)); |
218 | return first_cpu(*mask); | ||
219 | } | 230 | } |
220 | #endif | 231 | #endif |
221 | 232 | ||
222 | extern cpumask_t cpu_coregroup_map(int cpu); | 233 | extern cpumask_t cpu_coregroup_map(int cpu); |
234 | extern const struct cpumask *cpu_coregroup_mask(int cpu); | ||
223 | 235 | ||
224 | #ifdef ENABLE_TOPO_DEFINES | 236 | #ifdef ENABLE_TOPO_DEFINES |
225 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) | 237 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) |