On Thu, Dec 5, 2024 at 4:54 PM Baolin Wang
<baolin.wang@xxxxxxxxxxxxxxxxx> wrote:
Commit 5d65c8d758f2 ("mm: count the number of anonymous THPs per size") adds
a new anonymous counter per THP size, however, when folio_mapping() is not NULL
during folio migration, it means this is not an anonymous folio, so remove the
redundant anonymous statistics in this case.
why? Are you sure anon folios won't call __folio_migrate_mapping()?
folio->mapping is PAGE_MAPPING_ANON for anon folios.
static __always_inline bool folio_test_anon(const struct folio *folio)
{
return ((unsigned long)folio->mapping & PAGE_MAPPING_ANON) != 0;
}