Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] mm: support splitting mappingless swapcache folios
@ 2026-08-05 11:18 Shivam Kalra via B4 Relay
  2026-08-05 11:18 ` [PATCH 1/3] mm/huge_memory: allow " Shivam Kalra via B4 Relay
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Shivam Kalra via B4 Relay @ 2026-08-05 11:18 UTC (permalink / raw)
  To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes, Zi Yan,
	Baolin Wang, Liam R. Howlett, Ryan Roberts, Dev Jain, Barry Song,
	Lance Yang, Usama Arif, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Shuah Khan, Nico Pache
  Cc: linux-mm, linux-kernel, linux-kselftest, Shivam Kalra

Large shmem folios lose their address-space mapping when they are written
to swap, but remain valid members of the swap cache. Folios read from swap
but not yet associated with an anon_vma can have the same mappingless
swapcache state. folio_check_splittable() currently mistakes both cases for
truncation and rejects the split with -EBUSY.

Implement the longstanding TODO for this state. Allow mappingless
swapcache folios to use the existing uniform order-0 swapcache split path,
while continuing to reject truly truncated folios and unsupported
higher-order or non-uniform swapcache splits.

memory_failure() is one caller affected by the restriction: it cannot
isolate a poisoned base page within a mappingless swapcache THP. The
end-to-end test uses this case to exercise the complete shmem pageout,
swapcache split, and swapin path.

The first patch contains the MM implementation. The second adds focused
KUnit coverage for the split eligibility checks. The third adds the
end-to-end hwpoison selftest, which pages out a shmem THP, poisons a tail
page, and verifies both isolation and the data read back from swap.

Tests:
  - The split_hwpoison_swapcache kselftest passes under x86_64 QEMU
      using virtme-ng 1.41 (2 GiB RAM, 4 KiB pages). 

Signed-off-by: Shivam Kalra <shivamkalra98@zohomail.in>
---
Shivam Kalra (3):
      mm/huge_memory: allow splitting mappingless swapcache folios
      mm: add KUnit coverage for mappingless swapcache folios
      selftests/mm: test hwpoison recovery of mappingless swapcache THPs

 mm/Kconfig                                         |  14 ++
 mm/Makefile                                        |   1 +
 mm/huge_memory.c                                   |  18 +-
 mm/tests/folio_split_kunit.c                       |  52 ++++
 tools/testing/selftests/mm/Makefile                |   2 +
 tools/testing/selftests/mm/run_vmtests.sh          |   1 +
 .../selftests/mm/split_hwpoison_swapcache.sh       |  57 +++++
 .../selftests/mm/split_hwpoison_swapcache_test.c   | 261 +++++++++++++++++++++
 8 files changed, 395 insertions(+), 11 deletions(-)
---
base-commit: 0b53bff4fa05ff0d3ffbd3d3bb10fae69dfab498
change-id: 20260722-b4-mappingless-swapcache-9badf123138a

Best regards,
--  
Shivam Kalra <shivamkalra98@zohomail.in>




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-08-05 15:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-05 11:18 [PATCH 0/3] mm: support splitting mappingless swapcache folios Shivam Kalra via B4 Relay
2026-08-05 11:18 ` [PATCH 1/3] mm/huge_memory: allow " Shivam Kalra via B4 Relay
2026-08-05 11:18 ` [PATCH 2/3] mm: add KUnit coverage for " Shivam Kalra via B4 Relay
2026-08-05 11:18 ` [PATCH 3/3] selftests/mm: test hwpoison recovery of mappingless swapcache THPs Shivam Kalra via B4 Relay
2026-08-05 12:03 ` [PATCH 0/3] mm: support splitting mappingless swapcache folios Zi Yan
2026-08-05 15:54   ` Kairui Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox