From: Shakeel Butt <shakeel.butt@linux.dev>
To: "Lorenzo Stoakes (Oracle)" <ljs@kernel.org>
Cc: lsf-pc@lists.linux-foundation.org,
Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.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>, Gregory Price <gourry@gourry.net>,
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: Thu, 26 Mar 2026 11:49:49 -0700 [thread overview]
Message-ID: <acV5d7D7wsoN2aa4@linux.dev> (raw)
In-Reply-To: <42e26dbb-0180-4408-b8a8-be0cafb75ad9@lucifer.local>
On Thu, Mar 26, 2026 at 11:43:46AM +0000, Lorenzo Stoakes (Oracle) wrote:
> On Wed, Mar 25, 2026 at 02:06:37PM -0700, Shakeel Butt wrote:
[...]
> >
> > The Fix: One Reclaim, Pluggable and Extensible
> > -----------------------------------------------
> >
> > We need one reclaim system, not two. One code path that everyone
> > maintains, everyone tests, and everyone benefits from. But it needs to
> > be pluggable as there will always be cases where someone wants some
> > customization for their specialized workload or wants to explore some
> > new techniques/ideas, and we do not want to get into the current mess
> > again.
>
> OK so I was with you up until the pluggable bit :) it's like you're
> combining two things here, obviously - unification and pluggability.
>
> I think we should consider both separately.
Yes, I should be more explicit that these are two different steps. First
unification and then provide a framework for extensibility.
[...]
>
> > New ideas get implemented as new policies, not as 3,000-line forks. Good
> > mechanisms from MGLRU (page table scanning, Bloom filters, lookaround)
> > become shared infrastructure available to any policy. And if someone
> > comes up with a better eviction algorithm tomorrow, they plug it in
> > without touching the core.
> >
> > Making reclaim pluggable implies we define it as a set of function
> > methods (let's call them reclaim_ops) hooking into a stable codebase we
> > rarely modify. We then have two big questions to answer: how do these
> > reclaim ops look, and how do we move the existing code to the new model?
>
> Hmm, I'm not so sure about that. But it depends really on who has access to
> these operations.
>
> The issue with operations in general is that they eliminate the possibility
> of the general code being able to make assumptions about what's happening.
>
> For instance, the .mmap f_op callback meant that we had to account for any
> possible thing being done by a driver. You couldn't make assumptions about
> vma state, page table state, etc. and of course things happened that we
> didn't anticipate, leading to bugs.
>
> So I guess it's less 'no ops' more so 'what do we actually expose to the
> ops', 'what assumptions do we bake in about how the ops are used' and very
> importantly - 'who gets to populate them'.
>
> If they're _exclusively_ mm-internal then that's fine.
>
> Reclaim is a _very_ _very_ sensitive part of mm. At the point it's being
> activated you may be under extreme memory pressure, so a hook even
> allocating at all may either fail or enter infinite loops.
>
> We are also very sensitive on things like rmap locks and also, of course, -
> timing.
>
> It's not just a perf concern, if we are too slow, we might end up thrashing
> when we could otherwise not have.
>
> Also there ends up being a question of how much now-internal functionality
> we end up exposing to users.
>
> So we really need a good definition of who we intend should use this stuff,
> and how any such interface should be designed.
>
> I mean, if sufficiently abstracted, and with very carefully restricted
> constrainst perhaps we could work around a lot of this but we have to tread
> _very_ carefully here.
Good points and I think we are still at the early stage of defining what
operations these would be. One of the complain during MGLRU upstream effort was
that the traditional LRU is too rigid and is very hard to experiment new ideas.
I want to eliminate such future complains. If you want to experiment some new
algorithm or new heuristic, experiment using the new framework.
I think once we start unifying the reclaim mechanisms, these operations will
start becoming more clear.
prev parent reply other threads:[~2026-03-26 18:50 UTC|newest]
Thread overview: 29+ 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-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-26 18:49 ` Shakeel Butt [this message]
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=acV5d7D7wsoN2aa4@linux.dev \
--to=shakeel.butt@linux.dev \
--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=hannes@cmpxchg.org \
--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=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