From: Johannes Weiner <hannes@cmpxchg.org>
To: "Lorenzo Stoakes (Oracle)" <ljs@kernel.org>
Cc: Gregory Price <gourry@gourry.net>,
Shakeel Butt <shakeel.butt@linux.dev>,
lsf-pc@lists.linux-foundation.org,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Michal Hocko <mhocko@kernel.org>,
Qi Zheng <zhengqi.arch@bytedance.com>,
Chen Ridong <chenridong@huaweicloud.com>,
Emil Tsalapatis <emil@etsalapatis.com>,
Alexei Starovoitov <ast@kernel.org>,
Axel Rasmussen <axelrasmussen@google.com>,
Yuanchu Xie <yuanchu@google.com>, Wei Xu <weixugc@google.com>,
Kairui Song <ryncsn@gmail.com>,
Matthew Wilcox <willy@infradead.org>,
Nhat Pham <nphamcs@gmail.com>, Barry Song <21cnbao@gmail.com>,
David Stevens <stevensd@google.com>,
Vernon Yang <vernon2gm@gmail.com>,
David Rientjes <rientjes@google.com>,
Kalesh Singh <kaleshsingh@google.com>,
wangzicheng <wangzicheng@honor.com>,
"T . J . Mercier" <tjmercier@google.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Suren Baghdasaryan <surenb@google.com>,
Meta kernel team <kernel-team@meta.com>,
bpf@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [LSF/MM/BPF TOPIC] Towards Unified and Extensible Memory Reclaim (reclaim_ext)
Date: Fri, 27 Mar 2026 15:53:04 -0400 [thread overview]
Message-ID: <acbgIKuwDsPvPjdF@cmpxchg.org> (raw)
In-Reply-To: <248a126c-43e7-4320-b4bb-282e0b6da9c4@lucifer.local>
On Thu, Mar 26, 2026 at 03:35:28PM +0000, Lorenzo Stoakes (Oracle) wrote:
> On Thu, Mar 26, 2026 at 10:24:28AM -0500, Gregory Price wrote:
> > ... snip snip snip ...
> >
> > > >
> > > > How Do We Get There
> > > > -------------------
> > > >
> > > > Do we merge the two mechanisms feature by feature, or do we prioritize
> > > > moving MGLRU to the pluggable model then follow with LRU once we are
> > > > happy with the result?
> > >
> > > Absolutely by a distance the first is preferable. The pluggability is
> > > controversial here and needs careful consideration.
> > >
> >
> > Pluggability asside - I do not think merging these two things "feature
> > by feature" is actually feasible (I would be delighted to be wrong).
> >
> > Many MGLRU "features" solve problems that MGLRU invents for itself.
> >
> > Take MGLRU's PID controller - its entire purpose is to try to smooth out
> > refault rates and "learn" from prior mistakes - but it's fundamentally
> > tied to MGLRU's aging system, and the aging systems differ greatly.
> >
> > - LRU: actual lists - active/inactive - that maintain ordering
> > - MGLRU: "generations", "inter-generation tiers", aging-in-place
> >
> > "Merging" this is essentially inventing something completely new - or
> > more reasonably just migrating everyone to MGLRU.
> >
> > In terms of managing risk, it seems far more reasonable to either split
> > MGLRU off into its own file and formalize the interface (ops), or simply
> > rip it out and let each individual feature fight its way back in.
>
> But _surely_ (and Shakeel can come back on this I guess) there are things that
> are commonalities.
There are some commonalities, but MGLRU was almost maximalist in its
approach to finding parallel solutions and reinventing various wheels
with little commentary, explanations or isolated testing.
For example, MGLRU took a totally different, ad-hoc approach to
dealing with dirty and writeback pages. It's been converging on the
LRU mechanism. This process has been stretching out for years, with
users eventually running into all the same problems that shaped the
LRU implementation to begin with. Yes, you need to wake flushers from
reclaim. Yes, you will OOM if you don't throttle on writeback.
There are many other divergences like this that complicate the picture:
- Cgroup tree iteration, per-zone lists to implement node reclaim.
- Divergent anon/file balancing policies.
- A notably different approach to scan resistance.
Many of these were not part of the main pitch at the time, but they’ve
created sizable technical debt that we’re now forced to reconcile.
I think MGLRU's NIH-attitude towards the problem space set it up for
running into past lessons again and learning the hard way, just like
with writeback.
The good thing is that there are some integration efforts now, even if
they don't come from the people that promised them. And some of them
do exactly the targeted, rigorous tests on a per-component basis that
is needed to sort it out (and was asked for back then).
But there are many workloads, many hardware configurations, and many
cornercases to cover, so this will take time. The end result doesn't
just need to be fast for some workloads, it also needs to be
universal, robust, easy to reason about and predictable.
Based on the current differences and how unification has been going so
far, I think it's premature to claim that we're close to deleting one.
And the current code structure makes it difficult to whittle down the
differences methodically.
IMO modularization is the best path forward. Giving people the ability
to experiment with a la carte combinations of features would make it
much easier to actually production test and prove individual ideas.
A nice side effect of this is that entirely new ideas would also be
easier to try out.
I think a good start would be to keep the common bits - "library" code
like shrink_folio_list() list and shared facilities like kswapd - in
vmscan.c. Move LRU and MGLRU specifics to their own files.
Then as much as possible extract and generalize functionality into the
common code so it can plug into both. For example, collecting accessed
bits from page tables instead of rmap chains should really not have to
be specific to one. Nor how the cgroup tree is iterated.
It might be possible to make N lists a natural extension of 2 lists,
so that the tracking datastructures themselves can be shared. With
minimal parameterization from the policy engines.
If we can get to a place where the only difference is how reference
data is interpreted and causes the lists to be sorted - you know, the
actual replacement policy - that is a much more manageable gap to
evaluate and argue about. Or swap out to try entirely new ones.
next prev parent reply other threads:[~2026-03-27 19:53 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 21:06 [LSF/MM/BPF TOPIC] Towards Unified and Extensible Memory Reclaim (reclaim_ext) Shakeel Butt
2026-03-26 0:10 ` T.J. Mercier
2026-03-26 2:05 ` Andrew Morton
2026-03-26 7:03 ` Michal Hocko
2026-03-26 8:02 ` Lorenzo Stoakes (Oracle)
2026-03-26 12:37 ` Kairui Song
2026-03-26 13:13 ` Lorenzo Stoakes (Oracle)
2026-03-26 13:42 ` David Hildenbrand (Arm)
2026-03-26 13:45 ` Lorenzo Stoakes (Oracle)
2026-03-26 16:02 ` Lorenzo Stoakes (Oracle)
2026-03-26 20:02 ` Axel Rasmussen
2026-03-26 20:30 ` Gregory Price
2026-03-26 20:47 ` Axel Rasmussen
2026-03-27 3:43 ` Matthew Wilcox
2026-03-27 19:12 ` Tal Zussman
2026-03-27 19:43 ` Gregory Price
2026-03-27 8:07 ` [Lsf-pc] " Vlastimil Babka
2026-03-27 9:29 ` Lorenzo Stoakes (Oracle)
2026-03-26 12:06 ` Kairui Song
2026-03-26 12:31 ` Lorenzo Stoakes (Oracle)
2026-03-26 13:17 ` Kairui Song
2026-03-26 13:26 ` Lorenzo Stoakes (Oracle)
2026-03-26 13:21 ` Shakeel Butt
2026-03-26 7:12 ` Michal Hocko
2026-03-26 13:44 ` Shakeel Butt
2026-03-26 15:24 ` Michal Hocko
2026-03-26 18:21 ` Shakeel Butt
2026-03-26 7:18 ` wangzicheng
2026-03-26 11:43 ` Lorenzo Stoakes (Oracle)
2026-03-26 15:24 ` Gregory Price
2026-03-26 15:35 ` Lorenzo Stoakes (Oracle)
2026-03-26 16:32 ` Gregory Price
2026-03-26 16:40 ` Lorenzo Stoakes (Oracle)
2026-03-27 19:53 ` Johannes Weiner [this message]
2026-03-26 18:49 ` Shakeel Butt
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=acbgIKuwDsPvPjdF@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ast@kernel.org \
--cc=axelrasmussen@google.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=bpf@vger.kernel.org \
--cc=chenridong@huaweicloud.com \
--cc=david@kernel.org \
--cc=emil@etsalapatis.com \
--cc=gourry@gourry.net \
--cc=kaleshsingh@google.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=lsf-pc@lists.linux-foundation.org \
--cc=mhocko@kernel.org \
--cc=nphamcs@gmail.com \
--cc=rientjes@google.com \
--cc=ryncsn@gmail.com \
--cc=shakeel.butt@linux.dev \
--cc=stevensd@google.com \
--cc=surenb@google.com \
--cc=tjmercier@google.com \
--cc=vernon2gm@gmail.com \
--cc=wangzicheng@honor.com \
--cc=weixugc@google.com \
--cc=willy@infradead.org \
--cc=yuanchu@google.com \
--cc=zhengqi.arch@bytedance.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