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]
Date:   Fri, 28 May 2021 10:20:35 +0800
From:   Liu Shixin <liushixin2@...wei.com>
To:     Baoquan He <bhe@...hat.com>
CC:     Andrew Morton <akpm@...ux-foundation.org>,
        yangerkun <yangerkun@...wei.com>,
        Kefeng Wang <wangkefeng.wang@...wei.com>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm/page_alloc: fix counting of managed_pages


On 2021/5/28 7:47, Baoquan He wrote:
> On 05/27/21 at 08:57pm, Liu Shixin wrote:
>> The commit f63661566fad (mm/page_alloc.c: clear out zone->lowmem_reserve[]
>> if the zone is empty) clear out zone->lowmem_reserve[] if zone is empty.
>> But when zone is not empty and sysctl_lowmem_reserve_ratio[i] is set to zero,
>> zone_managed_pages(zone) is not counted in the managed_pages either. This is
>> inconsistent with the description of lowmen_reserve, so fix it.
> Right, this is a good catch. Thanks for the fixing. 
>
> Is it worth adding words in Documentation/admin-guide/sysctl/vm.rst
> to notice this?
>
> Reviewed-by: Baoquan He <bhe@...hat.com>
>
> Thanks
> Baoquan

With this patch, It's consistent with the calculation description of zone[i]'s protection[j].

This is implicit in the description so I don't think it's necessary to notice this.

>> Fixes: f63661566fad ("mm/page_alloc.c: clear out zone->lowmem_reserve[] if the zone is empty")
>> Reported-by: yangerkun <yangerkun@...wei.com>
>> Signed-off-by: Liu Shixin <liushixin2@...wei.com>
>> ---
>>  mm/page_alloc.c | 12 ++++++------
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index aaa1655cf682..49a2efce5a84 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -8061,14 +8061,14 @@ static void setup_per_zone_lowmem_reserve(void)
>>  			unsigned long managed_pages = 0;
>>  
>>  			for (j = i + 1; j < MAX_NR_ZONES; j++) {
>> -				if (clear) {
>> -					zone->lowmem_reserve[j] = 0;
>> -				} else {
>> -					struct zone *upper_zone = &pgdat->node_zones[j];
>> +				struct zone *upper_zone = &pgdat->node_zones[j];
>> +
>> +				managed_pages += zone_managed_pages(upper_zone);
>>  
>> -					managed_pages += zone_managed_pages(upper_zone);
>> +				if (clear)
>> +					zone->lowmem_reserve[j] = 0;
>> +				else
>>  					zone->lowmem_reserve[j] = managed_pages / ratio;
>> -				}
>>  			}
>>  		}
>>  	}
>> -- 
>> 2.18.0.huawei.25
>>
>>
> .
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ