Re: [PATCH 2/2] mm/migrate: exclude hugetlb folios from MTHP_STAT_NR_ANON accounting
From: David Hildenbrand (Arm)
Date: Fri Jul 03 2026 - 03:18:09 EST
>> newfolio->index = folio->index;
>> newfolio->mapping = folio->mapping;
>> - if (folio_test_anon(folio) && folio_test_large(folio))
>> + if (folio_test_anon(folio) && folio_test_large(folio) &&
>> + !folio_test_hugetlb(folio))
>
> If the hugetlb folio has a non-NULL mapping (i.e., it's a shared mapping), we
> should migrate it via hugetlbfs_migrate_folio()-
>>migrate_huge_page_move_mapping(). In other words, shared hugetlb mappings
> should not reach this path, so this hugetlb check can be dropped. Or am I
> missing something?
Good point: we should only reach here with anonymous folios that are in the
swapcache. That doesn't apply to hugetlb.
--
Cheers,
David