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-next>] [day] [month] [year] [list]
Message-ID: <D27E5778F399414A8B5D5F672064BAD8B3E5FB7B@dggemi529-mbs.china.huawei.com>
Date:   Tue, 11 Jun 2019 12:16:35 +0000
From:   "Chengang (L)" <cg.chen@...wei.com>
To:     Michal Hocko <mhocko@...nel.org>
CC:     "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "vbabka@...e.cz" <vbabka@...e.cz>,
        "osalvador@...e.de" <osalvador@...e.de>,
        "pavel.tatashin@...rosoft.com" <pavel.tatashin@...rosoft.com>,
        "mgorman@...hsingularity.net" <mgorman@...hsingularity.net>,
        "rppt@...ux.ibm.com" <rppt@...ux.ibm.com>,
        "richard.weiyang@...il.com" <richard.weiyang@...il.com>,
        "alexander.h.duyck@...ux.intel.com" 
        <alexander.h.duyck@...ux.intel.com>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: align up min_free_kbytes to multipy of 4

Hi Michal


>On Sun 09-06-19 17:10:28, ChenGang wrote:
>> Usually the value of min_free_kbytes is multiply of 4, and in this 
>> case ,the right shift is ok.
>> But if it's not, the right-shifting operation will lose the low 2 
>> bits, and this cause kernel don't reserve enough memory.
>> So it's necessary to align the value of min_free_kbytes to multiply of 4.
>> For example, if min_free_kbytes is 64, then should keep 16 pages, but 
>> if min_free_kbytes is 65 or 66, then should keep 17 pages.

>Could you describe the actual problem? Do we ever generate min_free_kbytes that would lead to unexpected reserves or is this trying to compensate for those values being configured from the userspace? If later why do we care at all?

>Have you seen this to be an actual problem or is this mostly motivated by the code reading?

I haven't seen an actual problem, and it's motivated by code reading.  Users can configure this value through interface /proc/sys/vm/min_free_kbytes, so I think a bit precious is better.

>> Signed-off-by: ChenGang <cg.chen@...wei.com>
>> ---
>>  mm/page_alloc.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d66bc8a..1baeeba 
>> 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -7611,7 +7611,8 @@ static void setup_per_zone_lowmem_reserve(void)
>>  
>>  static void __setup_per_zone_wmarks(void)  {
>> -	unsigned long pages_min = min_free_kbytes >> (PAGE_SHIFT - 10);
>> +	unsigned long pages_min =
>> +		(PAGE_ALIGN(min_free_kbytes * 1024) / 1024) >> (PAGE_SHIFT - 10);
>>  	unsigned long lowmem_pages = 0;
>>  	struct zone *zone;
>>  	unsigned long flags;
>> --
>> 1.8.5.6
>> 

>-- 
>Michal Hocko
>SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ