Re: [PATCH 1/2] mm/slab: Add kvfree_atomic() helper
From: Harry Yoo (Oracle)
Date: Wed Apr 29 2026 - 07:19:16 EST
On Tue, Apr 28, 2026 at 06:14:18PM +0200, Uladzislau Rezki (Sony) wrote:
> kvmalloc() now supports non-sleeping GFP flags, including
> the vmalloc fallback path. This means it may return vmalloc
> memory even for GFP_ATOMIC and GFP_NOWAIT allocations.
>
> Freeing such memory with kvfree() may then end up calling
> vfree(), which is not safe for non-sleeping contexts.
>
> Introduce kvfree_atomic() helper for such cases. It mirrors
> kvfree(), but uses vfree_atomic() for vmalloced memory.
>
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@xxxxxxxxx>
> ---
Oh, allowing k[v]free() to be called in interrupt context but not in
non-sleepable context is confusing... but that's not new.
Looks good to me,
Acked-by: Harry Yoo (Oracle) <harry@xxxxxxxxxx>
Thanks for fixing it, Ulad!
--
Cheers,
Harry / Hyeonggon