Merge branch 'for-upstream' of git://openrisc.net/jonas/linux
[pandora-kernel.git] / arch / x86 / mm / numa.c
index f5510d8..fbeaaf4 100644 (file)
@@ -496,6 +496,7 @@ static bool __init numa_meminfo_cover_memory(const struct numa_meminfo *mi)
 
 static int __init numa_register_memblks(struct numa_meminfo *mi)
 {
+       unsigned long uninitialized_var(pfn_align);
        int i, nid;
 
        /* Account for nodes with cpus and no memory */
@@ -511,6 +512,20 @@ static int __init numa_register_memblks(struct numa_meminfo *mi)
 
        /* for out of order entries */
        sort_node_map();
+
+       /*
+        * If sections array is gonna be used for pfn -> nid mapping, check
+        * whether its granularity is fine enough.
+        */
+#ifdef NODE_NOT_IN_PAGE_FLAGS
+       pfn_align = node_map_pfn_alignment();
+       if (pfn_align && pfn_align < PAGES_PER_SECTION) {
+               printk(KERN_WARNING "Node alignment %LuMB < min %LuMB, rejecting NUMA config\n",
+                      PFN_PHYS(pfn_align) >> 20,
+                      PFN_PHYS(PAGES_PER_SECTION) >> 20);
+               return -EINVAL;
+       }
+#endif
        if (!numa_meminfo_cover_memory(mi))
                return -EINVAL;