aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-02-16 11:11:10 -0500
committerTejun Heo <tj@kernel.org>2011-02-16 11:11:10 -0500
commit775ee85d7bff8ce7c7eccde90eda400658b650a3 (patch)
tree46dc2a5582dd7b87cf9422ac1f8e8ee8c9b67d20 /arch/x86/mm
parentc88aea7a70b0f014f98c695069ba91abc9e9b9a4 (diff)
x86-64, NUMA: Wrap node ID during emulation
Both emulation layout functions - split_nodes[_size]_interleave() - didn't wrap emulated nid while laying out the fake nodes and tried to avoid interating over the specified number of nodes, which is fragile. Now that the emulation code generates numa_meminfo, the node memblks don't need to be consecutive and emulated node IDs can simply wrap. This makes the code more robust and is necessary for updates to better handle the cases where the physical nodes are interleaved. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Yinghai Lu <yinghai@kernel.org> Cc: Brian Gerst <brgerst@gmail.com> Cc: Cyrill Gorcunov <gorcunov@gmail.com> Cc: Shaohui Zheng <shaohui.zheng@intel.com> Cc: David Rientjes <rientjes@google.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/numa_64.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 9736204337b8..dc9516587cf5 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -768,15 +768,7 @@ static int __init split_nodes_interleave(struct numa_meminfo *ei,
768 memblock_x86_hole_size(end, physnodes[i].end) < size) 768 memblock_x86_hole_size(end, physnodes[i].end) < size)
769 end = physnodes[i].end; 769 end = physnodes[i].end;
770 770
771 /* 771 ret = emu_setup_memblk(ei, nid++ % nr_nodes, i,
772 * Avoid allocating more nodes than requested, which can
773 * happen as a result of rounding down each node's size
774 * to FAKE_NODE_MIN_SIZE.
775 */
776 if (nodes_weight(physnode_mask) + nid >= nr_nodes)
777 end = physnodes[i].end;
778
779 ret = emu_setup_memblk(ei, nid++, i,
780 physnodes[i].start, 772 physnodes[i].start,
781 min(end, physnodes[i].end)); 773 min(end, physnodes[i].end));
782 if (ret < 0) 774 if (ret < 0)
@@ -873,7 +865,7 @@ static int __init split_nodes_size_interleave(struct numa_meminfo *ei,
873 memblock_x86_hole_size(end, physnodes[i].end) < size) 865 memblock_x86_hole_size(end, physnodes[i].end) < size)
874 end = physnodes[i].end; 866 end = physnodes[i].end;
875 867
876 ret = emu_setup_memblk(ei, nid++, i, 868 ret = emu_setup_memblk(ei, nid++ % MAX_NUMNODES, i,
877 physnodes[i].start, 869 physnodes[i].start,
878 min(end, physnodes[i].end)); 870 min(end, physnodes[i].end));
879 if (ret < 0) 871 if (ret < 0)