[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <897b04c9-dba3-44ae-8113-145ca3457cb3@huaweicloud.com>
Date: Fri, 6 Dec 2024 14:40:53 +0800
From: Chen Ridong <chenridong@...weicloud.com>
To: Yu Zhao <yuzhao@...gle.com>, Hugh Dickins <hughd@...gle.com>
Cc: akpm@...ux-foundation.org, mhocko@...nel.org, hannes@...xchg.org,
yosryahmed@...gle.com, roman.gushchin@...ux.dev, shakeel.butt@...ux.dev,
muchun.song@...ux.dev, davidf@...eo.com, vbabka@...e.cz, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, cgroups@...r.kernel.org,
chenridong@...wei.com, wangweiyang2@...wei.com
Subject: Re: [next -v1 3/5] memcg: simplify the mem_cgroup_update_lru_size
function
On 2024/12/6 13:33, Yu Zhao wrote:
> On Thu, Dec 5, 2024 at 6:45 PM Chen Ridong <chenridong@...weicloud.com> wrote:
>>
>> From: Chen Ridong <chenridong@...wei.com>
>>
>> In the `mem_cgroup_update_lru_size` function, the `lru_size` should be
>> updated by adding `nr_pages` regardless of whether `nr_pages` is greater
>> than 0 or less than 0. To simplify this function, add a check for
>> `nr_pages` == 0. When `nr_pages` is not equal to 0, perform the same
>> actions.
>>
>> Signed-off-by: Chen Ridong <chenridong@...wei.com>
>
> NAK.
>
> The commit that added that clearly explains why it was done that way.
Thank you for your reply.
I have read the commit message for ca707239e8a7 ("mm: update_lru_size
warn and reset bad lru_size") before sending my patch. However, I did
not quite understand why we need to deal with the difference between
'nr_pages > 0' and 'nr_pages < 0'.
The 'lru_zone_size' can only be modified in the
'mem_cgroup_update_lru_size' function. Only subtracting 'nr_pages' or
adding 'nr_pages' in a way that causes an overflow can make the size < 0.
For case 1, subtracting 'nr_pages', we should issue a warning if the
size goes below 0. For case 2, when adding 'nr_pages' results in an
overflow, there will be no warning and the size won't be reset to 0 the
first time it occurs . It might be that a warning will be issued the
next time 'mem_cgroup_update_lru_size' is called to modify the
'lru_zone_size'. However, as the commit message said, "the first
occurrence is the most informative," and it seems we have missed that
first occurrence.
As the commit message said: "and then the vast unsigned long size draws
page reclaim into a loop of repeatedly", I think that a warning should
be issued and 'lru_zone_size' should be reset whenever 'size < 0' occurs
for the first time, whether from subtracting or adding 'nr_pages'.
I am be grateful if you can explain more details, it has confused me for
a while. Thank you very much.
Best regards,
Ridong
Powered by blists - more mailing lists