From: Lance Yang <lance.yang@linux.dev>
To: "David Hildenbrand (Arm)" <david@kernel.org>,
akpm@linux-foundation.org, hannes@cmpxchg.org
Cc: ljs@kernel.org, shakeel.butt@linux.dev, mhocko@kernel.org,
david@fromorbit.com, roman.gushchin@linux.dev,
muchun.song@linux.dev, qi.zheng@linux.dev, yosry.ahmed@linux.dev,
ziy@nvidia.com, liam@infradead.org, usama.arif@linux.dev,
kas@kernel.org, vbabka@kernel.org, ryncsn@gmail.com,
zaslonko@linux.ibm.com, gor@linux.ibm.com,
wangkefeng.wang@huawei.com, baolin.wang@linux.alibaba.com,
baohua@kernel.org, dev.jain@arm.com, npache@redhat.com,
ryan.roberts@arm.com, cgroups@vger.kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] mm/thp: clear deferred split shrinker bits when queues drain
Date: Tue, 2 Jun 2026 20:47:05 +0800 [thread overview]
Message-ID: <63797977-1c18-4885-8099-f5c21c80da39@linux.dev> (raw)
In-Reply-To: <716c7351-2641-4317-8675-e07a16a1efe2@kernel.org>
On 2026/6/2 20:11, David Hildenbrand (Arm) wrote:
> On 6/2/26 06:38, Lance Yang wrote:
>> Sorry, I missed Johannes in Cc ...
>>
>> On 2026/6/2 12:34, Lance Yang wrote:
>>> From: Lance Yang <lance.yang@linux.dev>
>>>
>>> deferred_split_count() returns the raw list_lru count. When the per-memcg,
>>> per-node list is empty, that count is 0.
>>>
>>> That skips scanning, but it does not tell memcg reclaim that the shrinker
>>> is empty. shrink_slab_memcg() only clears the memcg shrinker bit when the
>>> count callback reports SHRINK_EMPTY.
>
> What's the effect of that? Would we consider it a fix that we'd want to backport?
Just a stale memcg shrinker bit :) I'd treat this patch as a small
cleanup.
Once the queue is empty, count_objects() returns 0. That skips the scan,
but shrink_slab_memcg() only clears the bit on SHRINK_EMPTY, not 0.
So memcg reclaim can keep calling the shrinker even though there is
nothing on that queue.
>>>
>>> Return SHRINK_EMPTY for an empty deferred split list, so the bit can be
>>> cleared once the queue has drained.
>>>
>>> Signed-off-by: Lance Yang <lance.yang@linux.dev>
>>> ---
>>> mm/huge_memory.c | 5 ++++-
>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
>>> index 72f6caf0fec6..62d598290c3b 100644
>>> --- a/mm/huge_memory.c
>>> +++ b/mm/huge_memory.c
>>> @@ -4397,7 +4397,10 @@ void deferred_split_folio(struct folio *folio, bool
>>> partially_mapped)
>>> static unsigned long deferred_split_count(struct shrinker *shrink,
>>> struct shrink_control *sc)
>>> {
>>> - return list_lru_shrink_count(&deferred_split_lru, sc);
>>> + unsigned long count;
>>> +
>>> + count = list_lru_shrink_count(&deferred_split_lru, sc);
>>> + return count ?: SHRINK_EMPTY;
>>> }
>>> static bool thp_underused(struct folio *folio)
>>
>
> This is against Johannes' work, right?
Yep, I noticed it there, but the behavior is older.
> If this is a fix, likely it would be fixing 87eaceb3faa5 ("mm: thp: make
> deferred split shrinker memcg aware"), right?
No missed reclaim, just some extra reclaim work :)
Cheers, Lance
next prev parent reply other threads:[~2026-06-02 12:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 4:34 [PATCH 1/1] mm/thp: clear deferred split shrinker bits when queues drain Lance Yang
2026-06-02 4:38 ` Lance Yang
2026-06-02 12:11 ` David Hildenbrand (Arm)
2026-06-02 12:47 ` Lance Yang [this message]
2026-06-02 17:33 ` David Hildenbrand (Arm)
2026-06-02 10:30 ` Usama Arif
2026-06-02 20:37 ` Andrew Morton
2026-06-03 2:00 ` Lance Yang
2026-06-03 8:02 ` David Hildenbrand (Arm)
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=63797977-1c18-4885-8099-f5c21c80da39@linux.dev \
--to=lance.yang@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=cgroups@vger.kernel.org \
--cc=david@fromorbit.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=gor@linux.ibm.com \
--cc=hannes@cmpxchg.org \
--cc=kas@kernel.org \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=npache@redhat.com \
--cc=qi.zheng@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=ryan.roberts@arm.com \
--cc=ryncsn@gmail.com \
--cc=shakeel.butt@linux.dev \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
--cc=wangkefeng.wang@huawei.com \
--cc=yosry.ahmed@linux.dev \
--cc=zaslonko@linux.ibm.com \
--cc=ziy@nvidia.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