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

From: Oscar Salvador (SUSE)

Date: Thu Nov 26 2026 - 05:00:02 EST


On Wed, Nov 25, 2026 at 11:33:02PM +0100, David Hildenbrand (Arm) 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: Oscar Salvador (SUSE) <osalvador@xxxxxxxxxx>



--
Oscar Salvador
SUSE Labs