From: Liu Shixin <liushixin2@huawei.com>
To: Baoquan He <bhe@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
yangerkun <yangerkun@huawei.com>,
Kefeng Wang <wangkefeng.wang@huawei.com>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/page_alloc: fix counting of managed_pages
Date: Fri, 28 May 2021 10:20:35 +0800 [thread overview]
Message-ID: <138221ad-5ae0-6db6-3572-b8324fb73fdd@huawei.com> (raw)
In-Reply-To: <20210527234750.GB31898@MiWiFi-R3L-srv>
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@redhat.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@huawei.com>
>> Signed-off-by: Liu Shixin <liushixin2@huawei.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
>>
>>
> .
>
next prev parent reply other threads:[~2021-05-28 2:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-27 12:57 Liu Shixin
2021-05-27 13:14 ` Liu Shixin
2021-05-27 23:47 ` Baoquan He
2021-05-28 2:20 ` Liu Shixin [this message]
2021-06-09 10:29 ` David Hildenbrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=138221ad-5ae0-6db6-3572-b8324fb73fdd@huawei.com \
--to=liushixin2@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=wangkefeng.wang@huawei.com \
--cc=yangerkun@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox