lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151126091201.GB30403@gmail.com>
Date:	Thu, 26 Nov 2015 10:12:01 +0100
From:	Ingo Molnar <mingo@...nel.org>
To:	Seth Jennings <sjennings@...iantweb.net>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>, Peter Anvin <hpa@...or.com>,
	Daniel J Blueman <daniel@...ascale.com>,
	Yinghai Lu <yinghai@...nel.org>, x86@...nel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: mm: clean up probe_memory_block_size()


* Seth Jennings <sjennings@...iantweb.net> wrote:

> 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@...iantweb.net>
> ---
>  arch/x86/mm/init_64.c | 22 ++++++----------------
>  1 file changed, 6 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index ec081fe..a83c470 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,15 @@ int kern_addr_valid(unsigned long addr)
>  
>  static unsigned long probe_memory_block_size(void)
>  {
> +	unsigned long bz = MIN_MEMORY_BLOCK_SIZE;
>  
> +	/* if system is UV or has 64GB of RAM or more, use large blocks */
> +	if (is_uv_system() || ((max_pfn << PAGE_SHIFT) >= (64UL << 30))) {
>  		pr_info("Using 2GB memory block size for large-memory system\n");
> +		bz = 2UL << 30; /* 2GB */
>  	}
>  
> +	pr_debug("memory block size : %ldMB\n", bz >> 20);
>  
>  	return bz;
>  }

So why keep 'bz' at all? Just return with the right value and be done with it. 
'bz' is just an unnecessary confusion factor.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ