[patch -mm] x86_64: fake numa cmdline flag fix

David Rientjes
2007-03-02T17:03:39Z

Make sure we only reference 'cmdline' on CONFIG_NUMA_EMU.

Signed-off-by: David Rientjes <rientjes@google.com>
---
arch/x86_64/mm/numa.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -524,22 +524,28 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
{
unsigned long start_addr = start_pfn << PAGE_SHIFT;
unsigned long end_addr = end_pfn << PAGE_SHIFT;
+ int numa_fake = 0;
int i;

+#ifdef CONFIG_NUMA_EMU
+ /* Determine if we have a numa=fake command line */
+ if (cmdline != 0)
+ numa_fake = 1;
+#endif
+
#ifdef CONFIG_ACPI_NUMA
- if (!numa_off && !cmdline && !acpi_scan_nodes(start_addr, end_addr))
+ if (!numa_off && !numa_fake && !acpi_scan_nodes(start_addr, end_addr))
return;
#endif

#ifdef CONFIG_K8_NUMA
- if (!numa_off && !k8_scan_nodes(start_addr, end_addr, cmdline != 0))
- if (cmdline == 0)
+ if (!numa_off && !k8_scan_nodes(start_addr, end_addr, numa_fake))
+ if (!numa_fake)
return;
#endif

#ifdef CONFIG_NUMA_EMU
- if (cmdline)
- {
+ if (numa_fake) {
numa_emu = !numa_emulation(start_pfn, end_pfn);
if (numa_emu)
return;