diff options
-rw-r--r-- | arch/x86/mm/numa_64.c | 8 | ||||
-rw-r--r-- | arch/x86/mm/numa_emulation.c | 14 |
2 files changed, 11 insertions, 11 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 | ||
diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index 607a2e8bc87a..0afa25d967ba 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c | |||
@@ -300,6 +300,7 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt) | |||
300 | static struct numa_meminfo pi __initdata; | 300 | static struct numa_meminfo pi __initdata; |
301 | const u64 max_addr = max_pfn << PAGE_SHIFT; | 301 | const u64 max_addr = max_pfn << PAGE_SHIFT; |
302 | u8 *phys_dist = NULL; | 302 | u8 *phys_dist = NULL; |
303 | size_t phys_size = numa_dist_cnt * numa_dist_cnt * sizeof(phys_dist[0]); | ||
303 | int i, j, ret; | 304 | int i, j, ret; |
304 | 305 | ||
305 | if (!emu_cmdline) | 306 | if (!emu_cmdline) |
@@ -336,21 +337,18 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt) | |||
336 | goto no_emu; | 337 | goto no_emu; |
337 | } | 338 | } |
338 | 339 | ||
339 | /* | 340 | /* copy the physical distance table */ |
340 | * Copy the original distance table. It's temporary so no need to | ||
341 | * reserve it. | ||
342 | */ | ||
343 | if (numa_dist_cnt) { | 341 | if (numa_dist_cnt) { |
344 | size_t size = numa_dist_cnt * sizeof(phys_dist[0]); | ||
345 | u64 phys; | 342 | u64 phys; |
346 | 343 | ||
347 | phys = memblock_find_in_range(0, | 344 | phys = memblock_find_in_range(0, |
348 | (u64)max_pfn_mapped << PAGE_SHIFT, | 345 | (u64)max_pfn_mapped << PAGE_SHIFT, |
349 | size, PAGE_SIZE); | 346 | phys_size, PAGE_SIZE); |
350 | if (phys == MEMBLOCK_ERROR) { | 347 | if (phys == MEMBLOCK_ERROR) { |
351 | pr_warning("NUMA: Warning: can't allocate copy of distance table, disabling emulation\n"); | 348 | pr_warning("NUMA: Warning: can't allocate copy of distance table, disabling emulation\n"); |
352 | goto no_emu; | 349 | goto no_emu; |
353 | } | 350 | } |
351 | memblock_x86_reserve_range(phys, phys + phys_size, "TMP NUMA DIST"); | ||
354 | phys_dist = __va(phys); | 352 | phys_dist = __va(phys); |
355 | 353 | ||
356 | for (i = 0; i < numa_dist_cnt; i++) | 354 | for (i = 0; i < numa_dist_cnt; i++) |
@@ -398,6 +396,10 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt) | |||
398 | numa_set_distance(i, j, dist); | 396 | numa_set_distance(i, j, dist); |
399 | } | 397 | } |
400 | } | 398 | } |
399 | |||
400 | /* free the copied physical distance table */ | ||
401 | if (phys_dist) | ||
402 | memblock_x86_free_range(__pa(phys_dist), __pa(phys_dist) + phys_size); | ||
401 | return; | 403 | return; |
402 | 404 | ||
403 | no_emu: | 405 | no_emu: |