Re: [PATCH v4] tracing: add 'accounted' entry into output of allocation tracepoints

From: Roman Gushchin
Date: Tue May 24 2022 - 21:34:45 EST


On Sat, May 21, 2022 at 09:36:54PM +0300, Vasily Averin wrote:
> Slab caches marked with SLAB_ACCOUNT force accounting for every
> allocation from this cache even if __GFP_ACCOUNT flag is not passed.
> Unfortunately, at the moment this flag is not visible in ftrace output,
> and this makes it difficult to analyze the accounted allocations.
>
> This patch adds boolean "accounted" entry into trace output,
> and set it to 'true' for calls used __GFP_ACCOUNT flag and
> for allocations from caches marked with SLAB_ACCOUNT.
>
> Signed-off-by: Vasily Averin <vvs@xxxxxxxxxx>
> Acked-by: Shakeel Butt <shakeelb@xxxxxxxxxx>
> ---
> v4:
> 1) replaced in patch descripion: "accounted" instead of "allocated"
> 2) added "Acked-by" from Shakeel,
> 3) re-addressed to akpm@
>
> v3:
> 1) rework kmem_cache_alloc* tracepoints once again,
> added struct kmem_cache argument into existing templates,
> thanks to Matthew Wilcox
> 2) updated according trace_* calls
> 3) added boolean "allocated" entry into trace output,
> thanks to Roman
> 4) updated patch subject and description
>
> v2:
> 1) handle kmem_cache_alloc_node(), thanks to Shakeel
> 2) rework kmem_cache_alloc* tracepoints to use cachep instead
> of current cachep->*size parameters.
> NB: kmem_cache_alloc_node tracepoint in SLOB cannot use cachep,
> and therefore it was replaced by kmalloc_node.
> ---
> include/trace/events/kmem.h | 38 +++++++++++++++++++++++--------------
> mm/slab.c | 10 +++++-----
> mm/slab_common.c | 9 ++++-----
> mm/slob.c | 8 ++++----
> mm/slub.c | 20 +++++++++----------
> 5 files changed, 47 insertions(+), 38 deletions(-)

LGTM

Acked-by: Roman Gushchin <roman.gushchin@xxxxxxxxx>

Thanks!