From: Baoquan He <baoquan.he@linux.dev>
To: Barry Song <baohua@kernel.org>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
kasong@tencent.com, qi.zheng@linux.dev, shakeel.butt@linux.dev,
baolin.wang@linux.alibaba.com, hannes@cmpxchg.org,
mhocko@kernel.org, Baoquan He <hebaoquan@kylinos.cn>
Subject: Re: [PATCH 1/4] mm/mglru: use a common helper to check evictable type
Date: Wed, 2 Dec 2026 16:43:19 +0800 [thread overview]
Message-ID: <aw_aJ9wp4Nri-lzl@fedora> (raw)
In-Reply-To: <CAGsJ_4wSsE0iEJOA5sN_K2F18cGDA4yKZwhYzm0dy4ae3j28qw@mail.gmail.com>
On 12/02/26 at 02:41pm, Barry Song wrote:
> On Wed, Dec 2, 2026 at 2:17 PM Baoquan He <baoquan.he@linux.dev> wrote:
> >
> > From: Baoquan He <hebaoquan@kylinos.cn>
> >
> > inc_min_seq() open-codes the evictable type check that
> > for_each_evictable_type() already expresses through min_type() and
> > max_type(). Use a shared is_type_evictable() helper so the two cannot
> > drift apart, and rename the done label to advance to make it clear that
> > a skipped rotation still advances min_seq.
> >
> > No functional change.
> >
> > Signed-off-by: Baoquan He <hebaoquan@kylinos.cn>
> > ---
> > mm/vmscan.c | 17 +++++++++--------
> > 1 file changed, 9 insertions(+), 8 deletions(-)
> >
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index be89bc2528a9..257305fe1cce 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -2785,6 +2785,11 @@ static bool should_clear_pmd_young(void)
> > #define min_type(swappiness) (!(swappiness))
> > #define max_type(swappiness) ((swappiness) < SWAPPINESS_ANON_ONLY)
> >
> > +static inline bool is_type_evictable(int type, int swappiness)
> > +{
> > + return type >= min_type(swappiness) && type <= max_type(swappiness);
> > +}
> > +
>
> To be honest, I find this quite hard to follow. Can't we just say
> something more explicit, like this?
LOL, I know people must complain about this. It's truly logically
twisted so that mglru expert need think a while to make it clear,
I like it a bit though, it's correct and neat. I will update it as
you suggested. Thanks for careful reviewing, and sorry for the code,
Barry.
>
> is_type_unevictable:
>
> ((type == LRU_GEN_FILE) && (swappiness == SWAPPINESS_ANON_ONLY))
> ||
> ((type == LRU_GEN_ANON) && !swappiness)
>
>
> Thanks,
> Barry
next prev parent reply other threads:[~2026-12-02 8:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 6:17 [PATCH 0/4] mm/mglru: cleanup series and a small correctness Baoquan He
2026-12-02 6:17 ` [PATCH 1/4] mm/mglru: use a common helper to check evictable type Baoquan He
2026-12-02 6:41 ` Barry Song
2026-12-02 8:43 ` Baoquan He [this message]
2026-12-02 6:17 ` [PATCH 2/4] mm/mglru: rename positive_ctrl_err() to should_reclaim() Baoquan He
2026-12-02 6:17 ` [PATCH 3/4] mm/mglru: split reset_ctrl_pos() into _update and _reset Baoquan He
2026-12-02 6:20 ` [PATCH 4/4] mm/mglru: stop counting isolation races as PGSCAN_SKIP in scan_folios() Baoquan He
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=aw_aJ9wp4Nri-lzl@fedora \
--to=baoquan.he@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=hannes@cmpxchg.org \
--cc=hebaoquan@kylinos.cn \
--cc=kasong@tencent.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=qi.zheng@linux.dev \
--cc=shakeel.butt@linux.dev \
/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