提交 ffd10a2b 编写于 作者: M Magnus Damm 提交者: Linus Torvalds

[PATCH] x86_64: Make node boundaries consistent

The current x86_64 NUMA memory code is inconsequent when it comes to node
memory ranges. The exact behaviour varies depending on which config option
that is used.

setup_node_bootmem() has start and end as arguments and these are used to
calculate the size of the node like this: (end - start). This is all fine
if end is pointing to the first non-available byte. The problem is that the
current x86_64 code sometimes treats it as the last present byte and sometimes
as the first non-available byte. The result is that some configurations might
lose a page at the end of the range.

This patch tries to fix CONFIG_ACPI_NUMA, CONFIG_K8_NUMA and CONFIG_NUMA_EMU
so they all treat the end variable as the first non-available byte. This is
the same way as the single node code.

The patch is boot tested on dual x86_64 hardware with the above configurations,
but maybe the removed code is needed as some workaround?
Signed-off-by: NMagnus Damm <magnus@valinux.co.jp>
Signed-off-by: NAndi Kleen <ak@suse.de>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 e583538f
...@@ -108,6 +108,7 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) ...@@ -108,6 +108,7 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
limit >>= 16; limit >>= 16;
limit <<= 24; limit <<= 24;
limit |= (1<<24)-1; limit |= (1<<24)-1;
limit++;
if (limit > end_pfn << PAGE_SHIFT) if (limit > end_pfn << PAGE_SHIFT)
limit = end_pfn << PAGE_SHIFT; limit = end_pfn << PAGE_SHIFT;
......
...@@ -209,8 +209,6 @@ static int numa_emulation(unsigned long start_pfn, unsigned long end_pfn) ...@@ -209,8 +209,6 @@ static int numa_emulation(unsigned long start_pfn, unsigned long end_pfn)
if (i == numa_fake-1) if (i == numa_fake-1)
sz = (end_pfn<<PAGE_SHIFT) - nodes[i].start; sz = (end_pfn<<PAGE_SHIFT) - nodes[i].start;
nodes[i].end = nodes[i].start + sz; nodes[i].end = nodes[i].start + sz;
if (i != numa_fake-1)
nodes[i].end--;
printk(KERN_INFO "Faking node %d at %016Lx-%016Lx (%LuMB)\n", printk(KERN_INFO "Faking node %d at %016Lx-%016Lx (%LuMB)\n",
i, i,
nodes[i].start, nodes[i].end, nodes[i].start, nodes[i].end,
......
...@@ -71,8 +71,6 @@ static __init void cutoff_node(int i, unsigned long start, unsigned long end) ...@@ -71,8 +71,6 @@ static __init void cutoff_node(int i, unsigned long start, unsigned long end)
nd->start = nd->end; nd->start = nd->end;
} }
if (nd->end > end) { if (nd->end > end) {
if (!(end & 0xfff))
end--;
nd->end = end; nd->end = end;
if (nd->start > nd->end) if (nd->start > nd->end)
nd->start = nd->end; nd->start = nd->end;
...@@ -166,8 +164,6 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma) ...@@ -166,8 +164,6 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
if (nd->end < end) if (nd->end < end)
nd->end = end; nd->end = end;
} }
if (!(nd->end & 0xfff))
nd->end--;
printk(KERN_INFO "SRAT: Node %u PXM %u %Lx-%Lx\n", node, pxm, printk(KERN_INFO "SRAT: Node %u PXM %u %Lx-%Lx\n", node, pxm,
nd->start, nd->end); nd->start, nd->end);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册