diff options
-rw-r--r-- | include/linux/topology.h | 17 | ||||
-rw-r--r-- | mm/page_alloc.c | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/topology.h b/include/linux/topology.h index dda6ee521e74..909b6e43b694 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
@@ -119,11 +119,20 @@ static inline int numa_node_id(void) | |||
119 | * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem(). | 119 | * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem(). |
120 | */ | 120 | */ |
121 | DECLARE_PER_CPU(int, _numa_mem_); | 121 | DECLARE_PER_CPU(int, _numa_mem_); |
122 | extern int _node_numa_mem_[MAX_NUMNODES]; | ||
122 | 123 | ||
123 | #ifndef set_numa_mem | 124 | #ifndef set_numa_mem |
124 | static inline void set_numa_mem(int node) | 125 | static inline void set_numa_mem(int node) |
125 | { | 126 | { |
126 | this_cpu_write(_numa_mem_, node); | 127 | this_cpu_write(_numa_mem_, node); |
128 | _node_numa_mem_[numa_node_id()] = node; | ||
129 | } | ||
130 | #endif | ||
131 | |||
132 | #ifndef node_to_mem_node | ||
133 | static inline int node_to_mem_node(int node) | ||
134 | { | ||
135 | return _node_numa_mem_[node]; | ||
127 | } | 136 | } |
128 | #endif | 137 | #endif |
129 | 138 | ||
@@ -146,6 +155,7 @@ static inline int cpu_to_mem(int cpu) | |||
146 | static inline void set_cpu_numa_mem(int cpu, int node) | 155 | static inline void set_cpu_numa_mem(int cpu, int node) |
147 | { | 156 | { |
148 | per_cpu(_numa_mem_, cpu) = node; | 157 | per_cpu(_numa_mem_, cpu) = node; |
158 | _node_numa_mem_[cpu_to_node(cpu)] = node; | ||
149 | } | 159 | } |
150 | #endif | 160 | #endif |
151 | 161 | ||
@@ -159,6 +169,13 @@ static inline int numa_mem_id(void) | |||
159 | } | 169 | } |
160 | #endif | 170 | #endif |
161 | 171 | ||
172 | #ifndef node_to_mem_node | ||
173 | static inline int node_to_mem_node(int node) | ||
174 | { | ||
175 | return node; | ||
176 | } | ||
177 | #endif | ||
178 | |||
162 | #ifndef cpu_to_mem | 179 | #ifndef cpu_to_mem |
163 | static inline int cpu_to_mem(int cpu) | 180 | static inline int cpu_to_mem(int cpu) |
164 | { | 181 | { |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index eee961958021..f3bc59f2ed52 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -85,6 +85,7 @@ EXPORT_PER_CPU_SYMBOL(numa_node); | |||
85 | */ | 85 | */ |
86 | DEFINE_PER_CPU(int, _numa_mem_); /* Kernel "local memory" node */ | 86 | DEFINE_PER_CPU(int, _numa_mem_); /* Kernel "local memory" node */ |
87 | EXPORT_PER_CPU_SYMBOL(_numa_mem_); | 87 | EXPORT_PER_CPU_SYMBOL(_numa_mem_); |
88 | int _node_numa_mem_[MAX_NUMNODES]; | ||
88 | #endif | 89 | #endif |
89 | 90 | ||
90 | /* | 91 | /* |