aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-03-02 05:32:47 -0500
committerTejun Heo <tj@kernel.org>2011-03-02 10:34:21 -0500
commiteb8c1e2c830fc25c93bc94e215ed387fe142a98d (patch)
tree21c87bb959e98a1639f6de575f8a630c4cb4e261 /arch
parentce0033307f1b45e23e0c149f56ea4855eb4687ce (diff)
x86-64, NUMA: Better explain numa_distance handling
Handling of out-of-bounds distances and allocation failure can use better documentation. Add it. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Yinghai Lu <yinghai@kernel.org> Acked-by: David Rientjes <rientjes@google.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/mm/numa_64.c11
-rw-r--r--arch/x86/mm/numa_emulation.c6
2 files changed, 15 insertions, 2 deletions
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 541746fdeb4b..74064e8ae79f 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -392,11 +392,12 @@ void __init numa_reset_distance(void)
392{ 392{
393 size_t size = numa_distance_cnt * numa_distance_cnt * sizeof(numa_distance[0]); 393 size_t size = numa_distance_cnt * numa_distance_cnt * sizeof(numa_distance[0]);
394 394
395 /* numa_distance could be 1LU marking allocation failure, test cnt */
395 if (numa_distance_cnt) 396 if (numa_distance_cnt)
396 memblock_x86_free_range(__pa(numa_distance), 397 memblock_x86_free_range(__pa(numa_distance),
397 __pa(numa_distance) + size); 398 __pa(numa_distance) + size);
398 numa_distance_cnt = 0; 399 numa_distance_cnt = 0;
399 numa_distance = NULL; 400 numa_distance = NULL; /* enable table creation */
400} 401}
401 402
402static int __init numa_alloc_distance(void) 403static int __init numa_alloc_distance(void)
@@ -447,6 +448,14 @@ static int __init numa_alloc_distance(void)
447 * Set the distance from node @from to @to to @distance. If distance table 448 * Set the distance from node @from to @to to @distance. If distance table
448 * doesn't exist, one which is large enough to accomodate all the currently 449 * doesn't exist, one which is large enough to accomodate all the currently
449 * known nodes will be created. 450 * known nodes will be created.
451 *
452 * If such table cannot be allocated, a warning is printed and further
453 * calls are ignored until the distance table is reset with
454 * numa_reset_distance().
455 *
456 * If @from or @to is higher than the highest known node at the time of
457 * table creation or @distance doesn't make sense, the call is ignored.
458 * This is to allow simplification of specific NUMA config implementations.
450 */ 459 */
451void __init numa_set_distance(int from, int to, int distance) 460void __init numa_set_distance(int from, int to, int distance)
452{ 461{
diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c
index 0afa25d967ba..aeecea93820f 100644
--- a/arch/x86/mm/numa_emulation.c
+++ b/arch/x86/mm/numa_emulation.c
@@ -379,7 +379,11 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
379 if (emu_nid_to_phys[i] == NUMA_NO_NODE) 379 if (emu_nid_to_phys[i] == NUMA_NO_NODE)
380 emu_nid_to_phys[i] = 0; 380 emu_nid_to_phys[i] = 0;
381 381
382 /* transform distance table */ 382 /*
383 * Transform distance table. numa_set_distance() ignores all
384 * out-of-bound distances. Just call it for every possible node
385 * combination.
386 */
383 numa_reset_distance(); 387 numa_reset_distance();
384 for (i = 0; i < MAX_NUMNODES; i++) { 388 for (i = 0; i < MAX_NUMNODES; i++) {
385 for (j = 0; j < MAX_NUMNODES; j++) { 389 for (j = 0; j < MAX_NUMNODES; j++) {