From: Oscar Salvador <osalvador@suse.de>
To: Vivek Kasireddy <vivek.kasireddy@intel.com>
Cc: dri-devel@lists.freedesktop.org, linux-mm@kvack.org,
Steve Sistare <steven.sistare@oracle.com>,
Muchun Song <muchun.song@linux.dev>,
David Hildenbrand <david@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v4 2/3] mm/memfd: Reserve hugetlb folios before allocation
Date: Wed, 18 Jun 2025 09:46:20 +0200 [thread overview]
Message-ID: <aFJuzKPG-7t_oflN@localhost.localdomain> (raw)
In-Reply-To: <20250618053415.1036185-3-vivek.kasireddy@intel.com>
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
next prev parent reply other threads:[~2025-06-18 7:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-18 5:30 [PATCH v4 0/3] " Vivek Kasireddy
2025-06-18 5:30 ` [PATCH v4 1/3] mm/hugetlb: Make hugetlb_reserve_pages() return nr of entries updated Vivek Kasireddy
2025-06-18 5:30 ` [PATCH v4 2/3] mm/memfd: Reserve hugetlb folios before allocation Vivek Kasireddy
2025-06-18 7:46 ` Oscar Salvador [this message]
2025-06-19 5:34 ` Kasireddy, Vivek
2025-06-18 5:30 ` [PATCH v4 3/3] selftests/udmabuf: Add a test to pin first before writing to memfd Vivek Kasireddy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aFJuzKPG-7t_oflN@localhost.localdomain \
--to=osalvador@suse.de \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=steven.sistare@oracle.com \
--cc=vivek.kasireddy@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox