Subject: Re: [PATCH v1 25/29] mm: simplify folio_expected_ref_count()

From: Harry Yoo <[email-masked]>
Date: Wed, 2 Jul 2025 22:40:39 +0900

On Mon, Jun 30, 2025 at 03:00:06PM +0200, David Hildenbrand wrote:
> Now that PAGE_MAPPING_MOVABLE is gone, we can simplify and rely on the
> folio_test_anon() test only.
> 
> ... but staring at the users, this function should never even have been
> called on movable_ops pages. E.g.,
> * __buffer_migrate_folio() does not make sense for them
> * folio_migrate_mapping() does not make sense for them
> * migrate_huge_page_move_mapping() does not make sense for them
> * __migrate_folio() does not make sense for them
> * ... and khugepaged should never stumble over them
> 
> Let's simply refuse typed pages (which includes slab) except hugetlb,
> and WARN.
> 
> Reviewed-by: Zi Yan <[email-masked]>
> Signed-off-by: David Hildenbrand <[email-masked]>
> ---

Yup, it doesn't really make sense to do this for typed pages
because they can't be mapped to userspace, except hugetlb.

LGTM,
Reviewed-by: Harry Yoo <[email-masked]>

-- 
Cheers,
Harry / Hyeonggon