From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Kairui Song <ryncsn@gmail.com>
Cc: "Barry Song (Xiaomi)" <baohua@kernel.org>,
akpm@linux-foundation.org, linux-mm@kvack.org,
axelrasmussen@google.com, baoquan.he@linux.dev,
chenridong@xiaomi.com, david@kernel.org, hannes@cmpxchg.org,
lianux.mm@gmail.com, linux-kernel@vger.kernel.org,
ljs@kernel.org, lyugaofei@xiaomi.com, mhocko@kernel.org,
qi.zheng@linux.dev, shakeel.butt@linux.dev,
stevensd@chromium.org, wangzicheng@honor.com, weixugc@google.com,
yuanchu@google.com
Subject: Re: [PATCH 0/3] mm/mglru: clean up isolate_folios and scan_folios for readability and clarity
Date: Tue, 25 Aug 2026 17:06:36 +0800 [thread overview]
Message-ID: <56b8e283-f849-4fd7-9c2a-64b604176a82@linux.alibaba.com> (raw)
In-Reply-To: <CAMgjq7DFpKU=QdT4QNAREL8oLg-OAxM6zMcYkCECBVg=U5ECsg@mail.gmail.com>
On 8/24/26 7:05 PM, Kairui Song wrote:
> On Mon, Aug 24, 2026 at 3:25 PM Baolin Wang
> <baolin.wang@linux.alibaba.com> wrote:
>> On 8/20/26 12:56 PM, Barry Song (Xiaomi) wrote:
>>> This is a cleanup series split out from the MGLRU swappiness series [1],
>>> with the cleanup changes separated to make them easier to review.
>>>
>>> Right now, isolate_folios() is quite difficult to follow:
>>>
>>> 1. It uses for_each_evictable_type(i, swappiness) to iterate over the
>>> types, but i is not actually used as the type within the loop body.
>>>
>>> 2. It uses scanned == 0 to detect whether the current reclaim type is
>>> exhausted, but this is not an accurate indication.
>>>
>>> 3. It has an internal retry when no folios can be isolated after scanning
>>> some folios, but the retry is implemented in a way nobody can understand.
>>>
>>> This patchset makes these behaviors explicit and much easier to follow.
>>>
>>> Run kernel builds for several rounds in a 1 GB memcg and take the
>>> average build time. The patchset shows almost no performance impact,
>>> with a very small improvement that could simply be noise:
>>
>> Just FYI:
>>
>> I tested this patchset with a 3G memcg limit and a 10G zram device,
>> running 'make -j32' to build kernel on my 32-core Arm machines, and got
>> some performance improvement for ths sys time:
>> w/o patch w/patch
>> sys 1845s 1570s
>>
>
> Hi Baoliln
>
> That's a very interesting result, can you share a bit more info about
> it? e.g. vmstat? I'm curious how this happens.
Sure.
> I suspect patch 2 or 3 changes the swappiness / reclaim / aging type
> selection behavior, or maybe it reduced the reclaim amount?
I gathered the memcg stats as shown below.
It looks like the direct reason for the performance improvement is an
obvious reduction in anon refaults, which is what this patch aims to
achieve I think. That is to say, we should respect the type chosen by
the PID for reclaim, and try to exhaust that type before falling back to
another.
Before this series:
workingset_refault_anon 59706846
workingset_refault_file 9229283
workingset_activate_anon 15108561
workingset_activate_file 365660
workingset_restore_anon 15108561
workingset_restore_file 1018493
workingset_nodereclaim 0
pgsteal_kswapd 0
pgsteal_direct 92589340
pgsteal_khugepaged 549
pgsteal_proactive 0
pgscan_kswapd 0
pgscan_direct 456629355
pgscan_khugepaged 549
After this series:
workingset_refault_anon 41277086
workingset_refault_file 9131522
workingset_activate_anon 12924656
workingset_activate_file 345901
workingset_restore_anon 12924656
workingset_restore_file 1005959
workingset_nodereclaim 0
pgsteal_kswapd 0
pgsteal_direct 71723800
pgsteal_khugepaged 4013
pgsteal_proactive 0
pgscan_kswapd 0
pgscan_direct 342179445
pgscan_khugepaged 9311
next prev parent reply other threads:[~2026-08-25 9:06 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 4:56 [PATCH 0/3] mm/mglru: clean up isolate_folios and scan_folios for readability and clarity Barry Song (Xiaomi)
2026-08-20 4:56 ` [PATCH 1/3] mm/mglru: improve readability of isolate_folios() Barry Song (Xiaomi)
2026-08-20 9:02 ` Baolin Wang
2026-08-20 9:22 ` Kairui Song
2026-08-28 3:15 ` Baoquan He
2026-08-28 3:22 ` Barry Song
2026-08-20 4:56 ` [PATCH 2/3] mm/mglru: improve scan_folios() exhaustion detection Barry Song (Xiaomi)
2026-08-21 1:44 ` Ridong Chen
2026-08-24 6:47 ` Baolin Wang
2026-08-25 21:44 ` Barry Song
2026-08-20 4:56 ` [PATCH 3/3] mm/mglru: retry the same type once if isolation fails due to races Barry Song (Xiaomi)
2026-08-21 1:45 ` Ridong Chen
2026-08-24 7:14 ` Baolin Wang
2026-08-20 7:56 ` [PATCH 0/3] mm/mglru: clean up isolate_folios and scan_folios for readability and clarity Lian Wang (ProcessMission)
2026-08-24 7:22 ` Baolin Wang
2026-08-24 11:05 ` Kairui Song
2026-08-25 9:06 ` Baolin Wang [this message]
2026-08-25 18:09 ` Kairui Song
2026-08-25 21:11 ` Barry Song
2026-08-27 6:21 ` Baolin Wang
2026-08-27 7:25 ` Kairui Song
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=56b8e283-f849-4fd7-9c2a-64b604176a82@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=baoquan.he@linux.dev \
--cc=chenridong@xiaomi.com \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=lianux.mm@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=lyugaofei@xiaomi.com \
--cc=mhocko@kernel.org \
--cc=qi.zheng@linux.dev \
--cc=ryncsn@gmail.com \
--cc=shakeel.butt@linux.dev \
--cc=stevensd@chromium.org \
--cc=wangzicheng@honor.com \
--cc=weixugc@google.com \
--cc=yuanchu@google.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