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 3/4] mm/mglru: split reset_ctrl_pos() into _update and _reset
Date: Thu, 3 Dec 2026 16:16:50 +0800 [thread overview]
Message-ID: <axElcv9BH_GEKXP-@fedora> (raw)
In-Reply-To: <CAGsJ_4wvY4eL1xJhZFrSS8+0iU-u_WZyxyad-_ZbKjdA30BJtw@mail.gmail.com>
On 12/02/26 at 06:12pm, 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>
> >
> > The single function reset_ctrl_pos() handled two opposite operations
> > controlled by a boolean 'carryover' flag:
> >
> > - carryover=true: fold retiring generation stats into the EMA,
> > and optionally clear the slot (from inc_min_seq)
> > - carryover=false: clear the slot for a new generation
> > (from inc_max_seq)
> >
> > The boolean also controlled which seq to use (min_seq or max_seq+1)
> > and whether to early-return. This made the logic unnecessarily twisted.
> >
> > Split it into two self-explanatory functions:
> >
> > - lru_gen_update_ctrl(): fold stats into EMA when retiring an
> > old generation; also clears the single history slot when
> > NR_HIST_GENS==1.
> >
> > - lru_gen_reset_ctrl(): clear the slot for the upcoming new
> > generation; no-op when NR_HIST_GENS==1 since _update already
> > handled it.
> >
>
> If we revise patch 2 along the lines of:
>
> https://lore.kernel.org/linux-mm/20261202095957.52379-1-baohua@kernel.org/
>
> we would end up with the following names here:
>
> update_refault_stats()
> reset_refault_stats()
>
> Let's try to hide all the control-theory details inside the helpers.
> LRU callers shouldn't need to know anything about "ctrl". The
> interfaces should expose only LRU-related semantics.
Yes, that sounds great. Let me consider this. Honestly, I am not sure if
'_stats' naming accurate, will think more about it. Maybe I will change
to another one, or take the one you suggested directly. Thanks.
next prev parent reply other threads:[~2026-12-03 8:17 UTC|newest]
Thread overview: 16+ 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
2026-12-02 21:49 ` Andrew Morton
2026-12-02 22:40 ` Barry Song
2026-12-03 1:22 ` Baoquan He
2026-12-02 6:17 ` [PATCH 2/4] mm/mglru: rename positive_ctrl_err() to should_reclaim() Baoquan He
2026-12-02 9:59 ` Barry Song (Xiaomi)
2026-12-03 8:13 ` 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 10:12 ` Barry Song
2026-12-03 8:16 ` Baoquan He [this message]
2026-12-02 6:20 ` [PATCH 4/4] mm/mglru: stop counting isolation races as PGSCAN_SKIP in scan_folios() Baoquan He
2026-12-02 9:22 ` Barry Song
2026-12-03 8:22 ` 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=axElcv9BH_GEKXP-@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