[RFC PATCH 0/1] Fix halted scanning of swap-cache folios

From: Thomas Hellström

Date: Mon Apr 27 2026 - 06:38:08 EST


While experimenting with an interface for inserting isolated dirty
GPU folios directly into the swap-cache for backup, I noticed that
when the number of swap entries were almost exhausted, scanning
and freeing of these pages already inserted into the swapc-cache
stopped.

Apparently there are guards that stop LRU scanning of anonymous
pages when the number of free swap entries are low. However that
also blocks pages already present in the swap cache from being
scanned and freed.

Not sure whether that is intentional, but anyway I'm sending
a patch that implements one (crude) way of fixing the problem.

Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: David Hildenbrand <david@xxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxxxx>
Cc: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx>
Cc: Shakeel Butt <shakeel.butt@xxxxxxxxx>
Cc: Lorenzo Stoakes <ljs@xxxxxxxxxx>
Cc: Axel Rasmussen <axelrasmussen@xxxxxxxxxx>
Cc: Yuanchu Xie <yuanchu@xxxxxxxxxx>
Cc: Wei Xu <weixugc@xxxxxxxxxx>
Cc: Brian Geffon <bgeffon@xxxxxxxxxx>
Cc: Steven Barrett <steven@xxxxxxxxxxxx>
Cc: Oleksandr Natalenko <oleksandr@xxxxxxxxxxxxxx>
Cc: linux-mm@xxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx

Thomas Hellström (1):
mm: vmscan: keep anon scanning enabled when swapcache folios are
present

mm/vmscan.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)

--
2.53.0