Commit 43c75f93 authored by Seth Jennings's avatar Seth Jennings Committed by Ingo Molnar

x86/mm: Streamline and restore probe_memory_block_size()

The cumulative effect of the following two commits:

  bdee237c ("x86: mm: Use 2GB memory block size on large-memory x86-64 systems")
  982792c7 ("x86, mm: probe memory block size for generic x86 64bit")

... is some pretty convoluted code.

The first commit also removed code for the UV case without stated reason,
which might lead to unexpected change in behavior.

This commit has no other (intended) functional change; just seeks to simplify
and make the code more understandable, beyond restoring the UV behavior.

The whole section with the "tail size" doesn't seem to be
reachable, since both the >= 64GB and < 64GB case return, so it
was removed.
Signed-off-by: default avatarSeth Jennings <sjennings@variantweb.net>
Cc: Daniel J Blueman <daniel@numascale.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1448902063-18885-1-git-send-email-sjennings@variantweb.net
[ Rewrote the title and changelog. ]
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 10a0c0f0
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <asm/numa.h> #include <asm/numa.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/init.h> #include <asm/init.h>
#include <asm/uv/uv.h>
#include <asm/setup.h> #include <asm/setup.h>
#include "mm_internal.h" #include "mm_internal.h"
...@@ -1193,26 +1194,13 @@ int kern_addr_valid(unsigned long addr) ...@@ -1193,26 +1194,13 @@ int kern_addr_valid(unsigned long addr)
static unsigned long probe_memory_block_size(void) static unsigned long probe_memory_block_size(void)
{ {
/* start from 2g */ unsigned long bz = MIN_MEMORY_BLOCK_SIZE;
unsigned long bz = 1UL<<31;
if (totalram_pages >= (64ULL << (30 - PAGE_SHIFT))) { /* if system is UV or has 64GB of RAM or more, use large blocks */
pr_info("Using 2GB memory block size for large-memory system\n"); if (is_uv_system() || ((max_pfn << PAGE_SHIFT) >= (64UL << 30)))
return 2UL * 1024 * 1024 * 1024; bz = 2UL << 30; /* 2GB */
}
/* 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); pr_info("x86/mm: Memory block size: %ldMB\n", bz >> 20);
return bz; return bz;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment