[PATCH v4 2/3] mm/memfd: Reserve hugetlb folios before allocation
Oscar Salvador
osalvador at suse.de
Wed Jun 18 07:46:20 UTC 2025
On Tue, Jun 17, 2025 at 10:30:54PM -0700, Vivek Kasireddy wrote:
> When we try to allocate a folio via alloc_hugetlb_folio_reserve(),
> we need to ensure that there is an active reservation associated
> with the allocation. Otherwise, our allocation request would fail
> if there are no active reservations made at that moment against any
> other allocations. This is because alloc_hugetlb_folio_reserve()
> checks h->resv_huge_pages before proceeding with the allocation.
>
> Therefore, to address this issue, we just need to make a reservation
> (by calling hugetlb_reserve_pages()) before we try to allocate the
> folio. This will also ensure that proper region/subpool accounting is
> done associated with our allocation.
I'm not really familiar with memfd code, but can't you make such
reservation when you create the file in alloc_file?
I see that you explicitly pass VM_NORESERVE. What's the reason for
that?
--
Oscar Salvador
SUSE Labs
More information about the dri-devel
mailing list