diff options
author | Yinghai Lu <yinghai@kernel.org> | 2011-03-02 05:22:14 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2011-03-02 10:34:09 -0500 |
commit | ce0033307f1b45e23e0c149f56ea4855eb4687ce (patch) | |
tree | a6e87fd74269aafacf62805252de181b9d499579 /arch/x86/mm/numa_64.c | |
parent | cc28989437de5617875a2943697fe6ba51a0da8f (diff) |
x86-64, NUMA: Fix distance table handling
NUMA distance table handling has the following problems.
* numa_reset_distance() uses numa_distance * sizeof(numa_distance[0])
as the table size when it should be using the square of
numa_distance.
* The same size miscalculation when allocation space for phys_dist in
numa_emulation().
* In numa_emulation(), phys_dist must be reserved; otherwise, the new
emulated distance table may overlap it.
Fix them and, while at it, take numa_distance_cnt resetting in
numa_reset_distance() out of the if block to simplify the code a bit.
David Rientjes reported incorrect handling of distance table during
emulation.
-tj: Edited out numa_alloc_distance() related changes which weren't
necessary and rewrote patch description.
-v2: Ingo was unhappy with 80-column limit induced linebreaks. Let
lines run over 80-column.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Reported-by: David Rientjes <rientjes@google.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>
Acked-by: David Rientjes <rientjes@google.com>
Diffstat (limited to 'arch/x86/mm/numa_64.c')
-rw-r--r-- | arch/x86/mm/numa_64.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index 7757d2214fab..541746fdeb4b 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c | |||
@@ -390,14 +390,12 @@ static void __init numa_nodemask_from_meminfo(nodemask_t *nodemask, | |||
390 | */ | 390 | */ |
391 | void __init numa_reset_distance(void) | 391 | void __init numa_reset_distance(void) |
392 | { | 392 | { |
393 | size_t size; | 393 | size_t size = numa_distance_cnt * numa_distance_cnt * sizeof(numa_distance[0]); |
394 | 394 | ||
395 | if (numa_distance_cnt) { | 395 | if (numa_distance_cnt) |
396 | size = numa_distance_cnt * sizeof(numa_distance[0]); | ||
397 | memblock_x86_free_range(__pa(numa_distance), | 396 | memblock_x86_free_range(__pa(numa_distance), |
398 | __pa(numa_distance) + size); | 397 | __pa(numa_distance) + size); |
399 | numa_distance_cnt = 0; | 398 | numa_distance_cnt = 0; |
400 | } | ||
401 | numa_distance = NULL; | 399 | numa_distance = NULL; |
402 | } | 400 | } |
403 | 401 | ||