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

Thomas Hellström
2026-04-27T10:35:55Z

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@linux-foundation.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Yuanchu Xie <yuanchu@google.com>
Cc: Wei Xu <weixugc@google.com>
Cc: Brian Geffon <bgeffon@google.com>
Cc: Steven Barrett <steven@liquorix.net>
Cc: Oleksandr Natalenko <oleksandr@natalenko.name>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org

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