Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754052AbbK3Qrw (ORCPT ); Mon, 30 Nov 2015 11:47:52 -0500 Received: from rs224.mailgun.us ([209.61.151.224]:36352 "EHLO rs224.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751847AbbK3Qru (ORCPT ); Mon, 30 Nov 2015 11:47:50 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=variantweb.net; s=smtp; q=dns; h=Sender: From: To: Cc: Subject: Date: Message-Id; b=NEr+TShte9EPQKlJ96MW1NKw0I36lyFQslhfb4JuYFioVj3JyZzma8uL/e5yiifDOcWBEP LKbX2W/8JM3Kgs+J0zhR8E5Nn827ZfcdoVSYWNxv+cALN0GAMUy5lTZxskIF4bQ2AKfTW0Rx Nw5dxh4v4XiqTIxIwe6Y04gyWyGAY= X-Mailgun-Sid: WyJmNDFlMyIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgIjlkYjc2Il0= From: Seth Jennings To: Thomas Gleixner Cc: Seth Jennings , Ingo Molnar , Peter Anvin , Daniel J Blueman , Yinghai Lu , x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCHv3] x86: mm: clean up probe_memory_block_size() Date: Mon, 30 Nov 2015 10:47:43 -0600 Message-Id: <1448902063-18885-1-git-send-email-sjennings@variantweb.net> X-Mailer: git-send-email 2.5.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2288 Lines: 70 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 --- 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 #include #include +#include #include #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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/