Skip to contentSkip to conversation

+ mm-vmscan-allow-writeout-of-swapcache-folios-without-anon-mappings.patch added to mm-hotfixes-unstable branch

PATCH Andrew Morton 1 participant 1 message Nov 10 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice
#0 lore raw

The patch titled
Subject: mm: vmscan: allow writeout of swapcache folios without anon mappings
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
mm-vmscan-allow-writeout-of-swapcache-folios-without-anon-mappings.patch

This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-vmscan-allow-writeout-of-swapcache-folios-without-anon-mappings.patch

This patch will later appear in the mm-hotfixes-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Nhat Pham <[email protected]>
Subject: mm: vmscan: allow writeout of swapcache folios without anon mappings
Date: Tue, 10 Nov 2026 07:14:05 -0800

Patch series "mm: fix swapcache writeout and cluster table races", v2.

Reviews of vswap and v1 of this series found bugs in existing swap code. Allow swapcache writeout without anon mappings, publish cluster tables with the allocator locks held, and leave tableless clusters to the allocator.

This patch (of 3):

Unfaulted zswap readahead folios can be dirty and in swapcache without an anonymous mapping. pageout() rejects them before swap_writeout(), so reclaim cannot write them out while their swap entries remain referenced.

Allow swapcache folios through the filesystem folio check. They already have swap entries and can use the existing swap writeout path. Anonymous folios outside swapcache have no mapping and already return PAGE_KEEP.

Fixes 84798514db50 ("mm: Remove swap_writepage() and shmem_writepage()")
Cc Johannes Weiner <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Qi Zheng <[email protected]>
Cc Shakeel Butt <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Kairui Song <[email protected]>
Cc Barry Song <[email protected]>
Cc Axel Rasmussen <[email protected]>
Cc Yuanchu Xie <[email protected]>
Cc Wei Xu <[email protected]>
Cc Baoquan He <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Christian Brauner <[email protected]>
Cc Christopher Li <[email protected]>
Cc Kemeng Shi <[email protected]>
Cc Youngjun Park <[email protected]>

---

 mm/vmscan.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
mm/vmscan.c renamed from mm/vmscan.c~mm-vmscan-allow-writeout-of-swapcache-folios-without-anon-mappings +2 -1
@@ -714,7 +714,8 @@ static pageout_t pageout(struct swap_io_
 	 */
 	if (folio_ref_count(folio) != 1 + folio_nr_pages(folio) || !mapping)
 		return PAGE_KEEP;
-	if (!shmem_mapping(mapping) && !folio_test_anon(folio))
+	/* Anonymous folios outside swapcache returned PAGE_KEEP above. */
+	if (!shmem_mapping(mapping) && !folio_test_swapcache(folio))
 		return PAGE_ACTIVATE;
 	if (!folio_clear_dirty_for_io(folio))
 		return PAGE_CLEAN;

_

Patches currently in -mm which might be from [email protected] are

mm-vmscan-allow-writeout-of-swapcache-folios-without-anon-mappings.patch mm-swap-publish-cluster-tables-after-reacquiring-allocator-locks.patch mm-swap-skip-relocation-of-tableless-clusters.patch