From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932468AbcASNjw (ORCPT ); Tue, 19 Jan 2016 08:39:52 -0500 Received: from terminus.zytor.com ([198.137.202.10]:43931 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932346AbcASNji (ORCPT ); Tue, 19 Jan 2016 08:39:38 -0500 Date: Tue, 19 Jan 2016 05:38:55 -0800 From: tip-bot for Seth Jennings Message-ID: Cc: mingo@kernel.org, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, sjennings@variantweb.net, tglx@linutronix.de, daniel@numascale.com, yinghai@kernel.org, peterz@infradead.org, hpa@zytor.com Reply-To: yinghai@kernel.org, daniel@numascale.com, peterz@infradead.org, hpa@zytor.com, mingo@kernel.org, torvalds@linux-foundation.org, sjennings@variantweb.net, linux-kernel@vger.kernel.org, tglx@linutronix.de In-Reply-To: <1448902063-18885-1-git-send-email-sjennings@variantweb.net> References: <1448902063-18885-1-git-send-email-sjennings@variantweb.net> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/mm] x86/mm: Streamline and restore probe_memory_block_size() Git-Commit-ID: 43c75f933be26422f166d6d869a19997312f4732 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 43c75f933be26422f166d6d869a19997312f4732 Gitweb: http://git.kernel.org/tip/43c75f933be26422f166d6d869a19997312f4732 Author: Seth Jennings AuthorDate: Mon, 30 Nov 2015 10:47:43 -0600 Committer: Ingo Molnar 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 Cc: Daniel J Blueman Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Yinghai Lu 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 --- 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 #include #include +#include #include #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; }