Re: [PATCH] slub: avoid duplicate trace_kmalloc() in __do_kmalloc_node()

From: Harry Yoo

Date: Fri Dec 04 2026 - 09:15:44 EST


Thanks for catching and fixing this Hao!

On Fri, Dec 04, 2026 at 10:39:38AM +0100, Vlastimil Babka (SUSE) wrote:
> On 12/4/26 05:18, Hao Li wrote:
> > The call path __do_kmalloc_node() -> __kmalloc_large_node_noprof()
> > results in duplicate trace_kmalloc() calls.
> >
> > Since __kmalloc_large_node_noprof() is a thin wrapper around
> > ___kmalloc_large_node(), call ___kmalloc_large_node() directly instead.
> > This skips the trace_kmalloc() in __kmalloc_large_node_noprof() and
> > eliminates the duplication.
> >
> > Fixes: a0a44d9175b3 ("mm, slab: don't wrap internal functions with alloc_hooks()")

I'd add Cc: stable as the patch is simple and it'll look like a memory
leak on some tools as allocation is counted twice and free is counted
only once.

> Closes: https://sashiko.dev/#/bug/linux-a862b54f-88e8-4e5f-b187-67f23315c7ca
>
> I know you found the problem independently before that bug was assigned to
> us, so just to complete the metadata.

I'll add it as I apply it, thanks.

--
Cheers,
Harry / Hyeonggon