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

From: Steven Rostedt
Date: Sun May 22 2022 - 16:11:17 EST


On Sun, 22 May 2022 07:33:08 +0300
Vasily Averin <vvs@xxxxxxxxxx> wrote:

> > slab_flags=SLAB_RECLAIM_ACCOUNT|SLAB_ACCOUNT|SLAB_STORE_USER
> > instead of just printing 'accounted=true/false'. This patch is too
> > specific to SLAB_ACCOUNT.
>
> Any extra output degrades performance.
> For my task it's not important to know SLAB flags, I just need to understand,
> is current allocation accounted or not.

If you do save the flags in the event, you can report that on output with
the __print_flags() macro:

TP_fast_assign(
[..]
__entry->sflags = s ? s->flags;
[..]
)
TP_printk("... slab_flags=%s ..",
[..]
__print_flags(sflags, "|",
{ SLAB_CONSISTENCY_CHECKS, "CONSISTENCY_CHECKS" },
{ SLAB_RED_ZONE, "RED_ZONE" },
{ SLAB_POISON, "POISON" },
{ SLAB_HWCACHE_ALIGN, "HWCACHE_ALIGN" },
{ SLAB_CACHE_DMA, "CACHE_DMA" },
{ SLAB_CACHE_DMA32, "CACHE_DMA32" },
{ SLAB_STORE_USER, "STORE_USER" },
{ SLAB_PANIC, "PANIC" }), ... )


And you get the flag output looking nicely, and all the processing is done
on the reader path.

That's if you find it useful at all.

-- Steve