Re: [PATCH -v4 1/4] mm/vmscan: fix anon-only reclaim evicting file pages when swappiness=max

From: Michal Hocko

Date: Mon Jul 27 2026 - 07:13:01 EST


On Mon 27-07-26 18:56:07, Barry Song wrote:
> On Mon, Jul 27, 2026 at 4:19 PM Michal Hocko <mhocko@xxxxxxxx> wrote:
> >
> > On Fri 24-07-26 11:34:32, Ridong wrote:
> > > From: Ridong Chen <chenridong@xxxxxxxxxx>
> > >
> > > As Qi mentioned [1], when swappiness=max (SWAPPINESS_ANON_ONLY) is set,
> > > the reclaim logic is expected to reclaim anonymous pages exclusively.
> > > However, due to the current ordering of checks in get_scan_count(),
> > > file pages may still be evicted if can_reclaim_anon_pages() returns
> > > false, which contradicts the semantics of SWAPPINESS_ANON_ONLY.
> >
> > But if can_reclaim_anon_pages tells us that anonymous pages are not
> > reclaimable then it makes no sense to try that, no? What do you expect
> > to see? An OOM killer?
>
> This is proactive reclaim rather than direct reclaim, and
> SWAPPINESS_ANON_ONLY is only supported for proactive reclaim. It
> therefore cannot invoke the OOM killer.
>
> If I understand correctly, this is exactly the issue this patch is
> trying to address. Instead of falling back to reclaiming file folios,
> it returns "bash: echo: write error: Resource temporarily unavailable".

My bad. I have misread the changelog and even missed the WARN_ON for
!pr-oactive reclaim path.

Failing pro-active makes sense.

--
Michal Hocko
SUSE Labs