From: "Jose A. Perez de Azpillaga" <azpijr@gmail.com>
To: Aveline Noir <jm5905938@gmail.com>,
Muchun Song <muchun.song@linux.dev>,
Oscar Salvador <osalvador@suse.de>,
Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Mike Kravetz <mike.kravetz@oracle.com>,
linux-mm@kvack.org
Subject: Re: [PATCH] mm/hugetlb: serialize subpool release with folio reserve restoration
Date: Fri, 27 Nov 2026 10:37:32 +0100 [thread overview]
Message-ID: <efee4fa3-b49e-445d-b1db-624ea589efdb@gmail.com> (raw)
In-Reply-To: <20261125-hugetlb-subpool-release-v1-1-7398c24d09b0@gmail.com>
On 11/25/26 9:28 AM, Aveline Noir wrote:
> Freeing the last folio of an unmounted min_size subpool can invoke
> hugetlb_acct_memory() from atomic folio_put() context, where its IRQ
> and bulk-freeing paths may enable interrupts, reschedule, or allocate
> vmemmap pages.
>
> In addition, the subpool minimum is released before the folio's
> reservation is restored, transiently underflowing resv_huge_pages. A
> concurrent allocation can consume the refilled subpool reservation, or
> unmount can release it, before the global counter is restored. Under the
> available_huge_pages() clamp, this underflow also prevents collecting
> unused surplus folios.
>
> For positive minima, take hugetlb_lock before dropping spool->lock and
> restore the folio reservation, release the minimum, and collect surplus
> folios in a single transaction. Keep subpool accounting outside
> hugetlb_lock, leave size-only and zero-minimum puts unnested, free
> collected folios outside the locks via the atomic-safe path (which
> defers HVO work), and skip zero-sized minimum releases that need no
> global accounting.
>
makes sense to me.
> The ordering came from 1c5ecae3a93f; the commit below made it reachable
> by enabling min_size and releasing its reservation on subpool teardown.
>
> Fixes: 7ca02d0ae586 ("hugetlbfs: accept subpool min_size mount option and setup accordingly")
> Signed-off-by: Aveline Noir <jm5905938@gmail.com>
LGTM so:
Reviewed-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
--
cheers,
jose a. p-a
prev parent reply other threads:[~2026-11-27 9:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 8:28 [PATCH] mm/hugetlb: serialize subpool release with folio reserve restoration Aveline Noir
2026-11-27 9:37 ` Jose A. Perez de Azpillaga [this message]
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=efee4fa3-b49e-445d-b1db-624ea589efdb@gmail.com \
--to=azpijr@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=jm5905938@gmail.com \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=muchun.song@linux.dev \
--cc=osalvador@suse.de \
--cc=rppt@kernel.org \
/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