Re: [PATCH] mm: move folio LRU helpers out of swap

From: Michal Hocko

Date: Tue Apr 07 2026 - 08:47:01 EST


On Tue 07-04-26 20:31:40, Jianyue Wu wrote:
> On 4/7/2026 7:20 PM, Michal Hocko wrote:
> >
> > All that big churn is really worth it? Are there any other reasons than
> > "not so appropriate"?
> >
> > Really if this is not a part of a much bigger plan then NAK.
>
> Hi Michal,
>
> The intent here is to keep generic LRU/reclaim helpers separate from
> swap-specific code paths.

OK, but why do we want this and cause a lot of code churn to achiev
that?

> The LRU helpers are shared by both file and anonymous memory, whereas
> swap.c is meant to host logic tied to swap devices and swap entries.
> Placing LRU code there would blur the boundary between general reclaim
> and swap, and make the code harder to follow.

The code is harder to follow than it could be, no questions about that.
But that alone is a rather weak argument to justify a lot of code move
that cause a lot of conflicts.

> Separately, I’ve been looking at routing zram’s swap-slot handling
> through swap-owned hooks (e.g., swap_ops / swapon probing), which would
> involve swapfile.c and swap.h. That’s likely orthogonal to this LRU
> move, but it’s driven by the same goal of clarifying the swap boundary.

Does that work benefits huge by this work?
--
Michal Hocko
SUSE Labs