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

Vasily Averin
2022-05-23T04:03:46Z

On 5/22/22 23:09, Steven Rostedt wrote:
> On Sun, 22 May 2022 07:33:08 +0300
> Vasily Averin <vvs@openvz.org> 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.

Thank you for explanation!
Yes, we can do it however I really doubt that any other slab flags are of interest to anyone.

Btw. in this form slab flags array causes sparse warnings,
because SLAB_* are defined as bitwise slab_flags_t.
This should be translated to unsigned long similarly to gfp_t flags.

Thank you,
Vasily Averin