Re: [PATCH v3 11/18] mm/huge_memory: allow splitting mappingless swap cache folios
From: David Hildenbrand (Arm)
Date: Thu Aug 27 2026 - 12:46:33 EST
> + if (anon_vma) {
> if (!ret && !folio_is_device_private(folio))
> ttu_flags = TTU_USE_SHARED_ZEROPAGE;
> remap_page(folio, 1 << old_order, ttu_flags);
> @@ -4259,6 +4261,7 @@ static int __folio_split(struct folio *folio, unsigned int new_order,
> struct page *split_at, struct page *lock_at,
> struct list_head *list, enum split_type split_type)
> {
> + bool is_swapcache = folio_test_swapcache(folio);
> struct folio *end_folio = folio_next(folio);
> bool is_anon = folio_test_anon(folio);
> int old_order = folio_order(folio);
> @@ -4285,8 +4288,11 @@ static int __folio_split(struct folio *folio, unsigned int new_order,
> }
>
> if (is_anon)
> - ret = __folio_split_unmap_and_freeze_anon(folio, new_order, split_at, true,
> - true, list, split_type);
> + ret = __folio_split_unmap_and_freeze(folio, new_order, split_at, true,
> + true, list, split_type);
> + else if (is_swapcache)
> + ret = __folio_split_unmap_and_freeze(folio, new_order, split_at, true,
> + false, list, split_type);
These two boolean parameters are really a pain. There must be a better way.
Also, I don't like that __folio_split_unmap_and_freeze() sounds generic again.
There must be a better way for that as well. We had a clean split and now we
mangle it again.
... but I am just before my PTO and out of puff, so others can brainstorm on how
to do this cleaner :)
--
Cheers,
David