]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/x86/mm/init_64.c
Merge branch 'akpm-current/current'
[karo-tx-linux.git] / arch / x86 / mm / init_64.c
index 6f881842116c19acae7242c9e51312aa2c175f91..3c7205d4de5292c45fa4fdc363220bec8e67a429 100644 (file)
@@ -1231,17 +1231,43 @@ const char *arch_vma_name(struct vm_area_struct *vma)
        return NULL;
 }
 
-#ifdef CONFIG_X86_UV
-unsigned long memory_block_size_bytes(void)
+static unsigned long probe_memory_block_size(void)
 {
+       /* start from 2g */
+       unsigned long bz = 1UL<<31;
+
+#ifdef CONFIG_X86_UV
        if (is_uv_system()) {
                printk(KERN_INFO "UV: memory block size 2GB\n");
                return 2UL * 1024 * 1024 * 1024;
        }
-       return MIN_MEMORY_BLOCK_SIZE;
-}
 #endif
 
+       /* less than 64g installed */
+       if ((max_pfn << PAGE_SHIFT) < (16UL << 32))
+               return MIN_MEMORY_BLOCK_SIZE;
+
+       /* get the tail size */
+       while (bz > MIN_MEMORY_BLOCK_SIZE) {
+               if (!((max_pfn << PAGE_SHIFT) & (bz - 1)))
+                       break;
+               bz >>= 1;
+       }
+
+       printk(KERN_DEBUG "memory block size : %ldMB\n", bz >> 20);
+
+       return bz;
+}
+
+static unsigned long memory_block_size_probed;
+unsigned long memory_block_size_bytes(void)
+{
+       if (!memory_block_size_probed)
+               memory_block_size_probed = probe_memory_block_size();
+
+       return memory_block_size_probed;
+}
+
 #ifdef CONFIG_SPARSEMEM_VMEMMAP
 /*
  * Initialise the sparsemem vmemmap using huge-pages at the PMD level.