From: Chen Ridong <chenridong@huaweicloud.com>
To: Shakeel Butt <shakeel.butt@linux.dev>
Cc: akpm@linux-foundation.org, axelrasmussen@google.com,
yuanchu@google.com, weixugc@google.com, david@kernel.org,
lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com,
vbabka@suse.cz, rppt@kernel.org, surenb@google.com,
mhocko@suse.com, corbet@lwn.net, hannes@cmpxchg.org,
roman.gushchin@linux.dev, muchun.song@linux.dev,
zhengqi.arch@bytedance.com, linux-mm@kvack.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
cgroups@vger.kernel.org, lujialin4@huawei.com,
zhongjinji@honor.com
Subject: Re: [PATCH -next 1/5] mm/mglru: use mem_cgroup_iter for global reclaim
Date: Tue, 23 Dec 2025 08:45:38 +0800 [thread overview]
Message-ID: <8aff3f15-79d6-48a0-a63d-735fabf6759d@huaweicloud.com> (raw)
In-Reply-To: <c4fjngkwbjlfnbjl5merldg5k2fiu43p46osagmy3ibr62cgxh@oesgt5l35kns>
On 2025/12/23 5:18, Shakeel Butt wrote:
> On Mon, Dec 22, 2025 at 03:27:26PM +0800, Chen Ridong wrote:
>>
> [...]
>>
>>>> - if (should_abort_scan(lruvec, sc))
>>>> + if (should_abort_scan(lruvec, sc)) {
>>>> + if (cookie)
>>>> + mem_cgroup_iter_break(target, memcg);
>>>> break;
>>>
>>> This seems buggy as we may break the loop without calling
>>> mem_cgroup_iter_break(). I think for kswapd the cookie will be NULL and
>>> if should_abort_scan() returns true, we will break the loop without
>>> calling mem_cgroup_iter_break() and will leak a reference to memcg.
>>>
>>
>> Thank you for catching that—my mistake.
>>
>> This also brings up another point: In kswapd, the traditional LRU iterates through all memcgs, but
>> stops for the generational LRU (GENLRU) when should_abort_scan is met (i.e., enough pages are
>> reclaimed or the watermark is satisfied). Shouldn't both behave consistently?
>>
>> Perhaps we should add should_abort_scan(lruvec, sc) in shrink_node_memcgs for the traditional LRU as
>> well?
>
> We definitely should discuss about should_abort_scan() for traditional
> reclaim but to keep things simple, let's do that after this series. For
> now, follow Johannes' suggestion of lru_gen_should_abort_scan().
>
Okey, understood.
--
Best regards,
Ridong
next prev parent reply other threads:[~2025-12-23 0:45 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-09 1:25 [PATCH -next 0/5] mm/mglru: remove memcg lru Chen Ridong
2025-12-09 1:25 ` [PATCH -next 1/5] mm/mglru: use mem_cgroup_iter for global reclaim Chen Ridong
2025-12-22 3:12 ` Shakeel Butt
2025-12-22 7:27 ` Chen Ridong
2025-12-22 21:18 ` Shakeel Butt
2025-12-23 0:45 ` Chen Ridong [this message]
2025-12-09 1:25 ` [PATCH -next 2/5] mm/mglru: remove memcg lru Chen Ridong
2025-12-22 3:24 ` Shakeel Butt
2025-12-09 1:25 ` [PATCH -next 3/5] mm/mglru: extend shrink_one for both lrugen and non-lrugen Chen Ridong
2025-12-12 2:55 ` kernel test robot
2025-12-12 9:53 ` Chen Ridong
2025-12-15 21:13 ` Johannes Weiner
2025-12-16 1:14 ` Chen Ridong
2025-12-22 21:36 ` Shakeel Butt
2025-12-23 1:00 ` Chen Ridong
2025-12-22 3:49 ` Shakeel Butt
2025-12-22 7:44 ` Chen Ridong
2025-12-09 1:25 ` [PATCH -next 4/5] mm/mglru: combine shrink_many into shrink_node_memcgs Chen Ridong
2025-12-15 21:17 ` Johannes Weiner
2025-12-16 1:23 ` Chen Ridong
2025-12-22 7:40 ` Chen Ridong
2025-12-09 1:25 ` [PATCH -next 5/5] mm/mglru: factor lrugen state out of shrink_lruvec Chen Ridong
2025-12-12 10:15 ` [PATCH -next 0/5] mm/mglru: remove memcg lru Chen Ridong
2025-12-15 16:18 ` Michal Koutný
2025-12-16 0:45 ` Chen Ridong
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=8aff3f15-79d6-48a0-a63d-735fabf6759d@huaweicloud.com \
--to=chenridong@huaweicloud.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=cgroups@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=lujialin4@huawei.com \
--cc=mhocko@suse.com \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=rppt@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=weixugc@google.com \
--cc=yuanchu@google.com \
--cc=zhengqi.arch@bytedance.com \
--cc=zhongjinji@honor.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