* [PATCHv3] x86: mm: clean up probe_memory_block_size()
@ 2015-11-30 16:47 Seth Jennings
2016-01-19 13:38 ` [tip:x86/mm] x86/mm: Streamline and restore probe_memory_block_size() tip-bot for Seth Jennings
0 siblings, 1 reply; 2+ messages in thread
From: Seth Jennings @ 2015-11-30 16:47 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Seth Jennings, Ingo Molnar, Peter Anvin, Daniel J Blueman,
Yinghai Lu, x86, linux-kernel
v2: remove bz local var, remove unneeded block size message (Ingo)
v3: restore bz local var, unify block size message (Ingo)
The cumulative effect of bdee237c and 982792c7 is some pretty convoluted
code. This commit has no (intended) functional change; just seeks to
simplify and make the code more understandable.
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.
This commit also adds code back for the UV case since it seemed to just
go away without reason in bdee237c and might lead to unexpected change
in behavior.
Signed-off-by: Seth Jennings <sjennings@variantweb.net>
---
arch/x86/mm/init_64.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index ec081fe..31c41c5 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -52,6 +52,7 @@
#include <asm/numa.h>
#include <asm/cacheflush.h>
#include <asm/init.h>
+#include <asm/uv/uv.h>
#include <asm/setup.h>
#include "mm_internal.h"
@@ -1194,26 +1195,13 @@ int kern_addr_valid(unsigned long addr)
static unsigned long probe_memory_block_size(void)
{
- /* start from 2g */
- unsigned long bz = 1UL<<31;
+ unsigned long bz = MIN_MEMORY_BLOCK_SIZE;
- if (totalram_pages >= (64ULL << (30 - PAGE_SHIFT))) {
- pr_info("Using 2GB memory block size for large-memory system\n");
- return 2UL * 1024 * 1024 * 1024;
- }
-
- /* 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;
- }
+ /* if system is UV or has 64GB of RAM or more, use large blocks */
+ if (is_uv_system() || ((max_pfn << PAGE_SHIFT) >= (64UL << 30)))
+ bz = 2UL << 30; /* 2GB */
- printk(KERN_DEBUG "memory block size : %ldMB\n", bz >> 20);
+ pr_info("x86/mm: Memory block size: %ldMB\n", bz >> 20);
return bz;
}
--
2.5.0
^ permalink raw reply [flat|nested] 2+ messages in thread* [tip:x86/mm] x86/mm: Streamline and restore probe_memory_block_size()
2015-11-30 16:47 [PATCHv3] x86: mm: clean up probe_memory_block_size() Seth Jennings
@ 2016-01-19 13:38 ` tip-bot for Seth Jennings
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Seth Jennings @ 2016-01-19 13:38 UTC (permalink / raw)
To: linux-tip-commits
Cc: mingo, torvalds, linux-kernel, sjennings, tglx, daniel, yinghai,
peterz, hpa
Commit-ID: 43c75f933be26422f166d6d869a19997312f4732
Gitweb: http://git.kernel.org/tip/43c75f933be26422f166d6d869a19997312f4732
Author: Seth Jennings <sjennings@variantweb.net>
AuthorDate: Mon, 30 Nov 2015 10:47:43 -0600
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 19 Jan 2016 12:11:25 +0100
x86/mm: Streamline and restore probe_memory_block_size()
The cumulative effect of the following two commits:
bdee237c0343 ("x86: mm: Use 2GB memory block size on large-memory x86-64 systems")
982792c782ef ("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: Seth 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: Ingo Molnar <mingo@kernel.org>
---
arch/x86/mm/init_64.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 8829482..8f18fec 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -52,6 +52,7 @@
#include <asm/numa.h>
#include <asm/cacheflush.h>
#include <asm/init.h>
+#include <asm/uv/uv.h>
#include <asm/setup.h>
#include "mm_internal.h"
@@ -1193,26 +1194,13 @@ int kern_addr_valid(unsigned long addr)
static unsigned long probe_memory_block_size(void)
{
- /* start from 2g */
- unsigned long bz = 1UL<<31;
+ unsigned long bz = MIN_MEMORY_BLOCK_SIZE;
- if (totalram_pages >= (64ULL << (30 - PAGE_SHIFT))) {
- pr_info("Using 2GB memory block size for large-memory system\n");
- return 2UL * 1024 * 1024 * 1024;
- }
-
- /* 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;
- }
+ /* if system is UV or has 64GB of RAM or more, use large blocks */
+ if (is_uv_system() || ((max_pfn << PAGE_SHIFT) >= (64UL << 30)))
+ bz = 2UL << 30; /* 2GB */
- printk(KERN_DEBUG "memory block size : %ldMB\n", bz >> 20);
+ pr_info("x86/mm: Memory block size: %ldMB\n", bz >> 20);
return bz;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-19 13:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-30 16:47 [PATCHv3] x86: mm: clean up probe_memory_block_size() Seth Jennings
2016-01-19 13:38 ` [tip:x86/mm] x86/mm: Streamline and restore probe_memory_block_size() tip-bot for Seth Jennings
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome