Re: [PATCH v2 10/35] mm/hugetlb: wait for deferred frees before failing an allocation
From: Jose A. Perez de Azpillaga
Date: Fri Dec 04 2026 - 05:50:27 EST
On 12/3/26 12:37 PM, David Hildenbrand (Arm) wrote:
> With optimized vmemmap, we defer freeing surplus folios to a workqueue,
> which restores the vmemmap and frees the folio, or adds it back to the
> pool if restoring the vmemmap fails.
>
> However, until the worker has run, the memory is neither in the buddy nor
> in the pool.
>
> Consequently, a task that unmaps surplus folios and immediately faults
> in new ones can get SIGBUS.
>
> Reproduced by artificially delaying the worker, filling memory with
> surplus folios, unmapping one and touching a new one: the task gets
> SIGBUS.
>
> Let's fix it by waiting for deferred frees and retrying once if an
> allocation fails while frees are pending.
>
> This has low urgency, as it requires overcommitting surplus folios under
> memory pressure. No need to CC stable.
>
> Fixes: b65d4adbc0f0 ("mm: hugetlb: defer freeing of HugeTLB pages")
> Reported-by: Chris Mason <mason@xxxxxxxxxx>
> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
with sashiko's WQ_MEM_RECLAIM point addressed feel free to add:
Reviewed-by: Jose A. Perez de Azpillaga <azpijr@xxxxxxxxx>
--
cheers,
jose a. p-a