Re: [PATCH v2 14/23] mm/slab_common: print cache name in tracepoints

From: Hyeonggon Yoo
Date: Sat Apr 30 2022 - 10:07:06 EST

On Fri, Apr 29, 2022 at 04:05:14PM +0200, Vlastimil Babka wrote:
> On 4/14/22 10:57, Hyeonggon Yoo wrote:
> > Print cache name in tracepoints. If there is no corresponding cache
> > (kmalloc in SLOB or kmalloc_large_node), use KMALLOC_{,LARGE_}NAME
> > macro.
> >
> > Signed-off-by: Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>
> Regarding tracepoints, I'm not sure it's a good idea to unify kmalloc and
> kmem_cache_alloc. I think the common use case is to trace kmalloc as there
> are many different callers, and then I'm not interested in kmem_cache_alloc
> callers much.

Make sense.

> What I would suggest instead is:
> - drop the _node versions, add node to normal versions
> - drop the kmem_alloc EVENT_CLASS, as kmalloc is different enough from
> kmem_cache_alloc (see next points), define separately as TRACE_EVENT().
> - printing cache_name makes sense to add for kmem_cache_alloc (also allows
> filtering events) but not for kmalloc.
> - kmem_cache_alloc with name can then drop the bytes_req, bytes_alloc as
> they are fixed for given name (and can be read from slabinfo).

Those suggestions makes sense to me.
kmalloc and kmem_cache_alloc are a bit different.

> Not using a common tracepoint will prevent some later unifications/cleanup
> (patch 21?), but hopefully not too much?

In v2 unification of __kmalloc_node()/kfree() somewhat depends on unified tracepoint.
I'll try to unify them with this approach in v3.