Re: [PATCH v2 2/4] mm/huge_memory: replace can_split_folio() with direct refcount calculation

From: David Hildenbrand (Red Hat)
Date: Tue Nov 25 2025 - 04:34:17 EST


On 11/25/25 10:10, Miaohe Lin wrote:
On 2025/11/25 5:08, Zi Yan wrote:
On 24 Nov 2025, at 14:22, David Hildenbrand (Red Hat) wrote:


<snip>


BTW, this page flag reuse is really confusing. I see PG_checked is
PG_owner_priv_1 too and __folio_migrate_mapping() uses folio_test_swapcache()
to decide the number of i_pages entries. Wouldn’t that cause any issue?
ext4 does not release_folio() for migration when PG_checked is set,
ubifs clears PG_checked in release_folio(). I have not checked all other FS
yet. Maybe later.

folio_test_swapbacked() is also checked in folio_test_swapcache:

static __always_inline bool folio_test_swapcache(struct folio *folio)
{
return folio_test_swapbacked(folio) &&
test_bit(PG_swapcache, folio_flags(folio, 0));
}

So IMHO the reuse of this page flag should work fine.

Ahh, thanks for pointing that out. Confusing, as usually the folio_test_*() helper are straight bit tests,

All good then :)

--
Cheers

David