Re: [PATCH 04/21] mm/memfd: mark new hugetlb folios migratable

From: Muchun Song

Date: Wed Nov 25 2026 - 21:05:29 EST




> On Nov 26, 2026, at 06:33, David Hildenbrand (Arm) <david@xxxxxxxxxx> wrote:
>
> memfd_alloc_folio() adds a new hugetlb folio to the page cache, but
> never sets it migratable, unlike hugetlb_no_page() and
> hugetlbfs_fallocate().
>
> Later faults will find it as an existing folio and never set the
> migratable flag.
>
> Such a folio can never be isolated for migration, even once it is no
> longer pinned, which breaks memory offlining, alloc_contig_range() and
> memory failure handling.
>
> Let's fix it by setting the new folio migratable after adding it to the
> page cache, like hugetlbfs_fallocate() already does.
>
> This has low urgency.
>
> Fixes: 89c1905d9c14 ("mm/gup: introduce memfd_pin_folios() for pinning memfd folios")
> Cc: <stable@xxxxxxxxxxxxxxx>
> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>

Reviewed-by: Muchun Song (ByteDance) <muchun.song@xxxxxxxxx>