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: <20201206115517.GL751215@kernel.org>
Date:   Sun, 6 Dec 2020 13:55:17 +0200
From:   Mike Rapoport <rppt@...nel.org>
To:     carver4lio@....com
Cc:     akpm@...ux-foundation.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, Hailong Liu <liu.hailong6@....com.cn>
Subject: Re: [PATCH] mm/memblock:use a more appropriate order calculation
 when free memblock pages

On Thu, Dec 03, 2020 at 11:23:10PM +0800, carver4lio@....com wrote:
> From: Hailong Liu <liu.hailong6@....com.cn>
> 
> When system in the booting stage, pages span from [start, end] of a memblock
> are freed to buddy in a order as large as possible (less than MAX_ORDER) at
> first, then decrease gradually to a proper order(less than end) in a loop.
> 
> However, *min(MAX_ORDER - 1UL, __ffs(start))* can not get the largest order
> in some cases.

Do you have examples?
What is the memory configration that casues suboptimal order selection
and what is the order in this case?

> Instead, *__ffs(end - start)* may be more appropriate and meaningful.

As several people reported using __ffs(end - start) is not correct.
If the order selection is indeed suboptimal we'd need some better
formula ;-)

> Signed-off-by: Hailong Liu <liu.hailong6@....com.cn>
> ---
>  mm/memblock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/memblock.c b/mm/memblock.c
> index b68ee8678..7c6d0dde7 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -1931,7 +1931,7 @@ static void __init __free_pages_memory(unsigned long start, unsigned long end)
>  	int order;
>  
>  	while (start < end) {
> -		order = min(MAX_ORDER - 1UL, __ffs(start));
> +		order = min(MAX_ORDER - 1UL, __ffs(end - start));
>  
>  		while (start + (1UL << order) > end)
>  			order--;
> -- 
> 2.17.1
> 
> 

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ