Re: [PATCH] tracing: add ACCOUNT flag for allocations from marked slab caches

From: Vasily Averin
Date: Mon May 16 2022 - 23:49:18 EST


On 5/17/22 01:08, Roman Gushchin wrote:
> On Mon, May 16, 2022 at 11:41:27PM +0200, Vlastimil Babka wrote:
>> On 5/16/22 21:10, Shakeel Butt wrote:
>>> On Mon, May 16, 2022 at 11:53 AM Vasily Averin <vvs@xxxxxxxxxx> wrote:
>>>> {
>>>> void *ret = slab_alloc(cachep, lru, flags, cachep->object_size, _RET_IP_);
>>>>
>>>> + if (cachep->flags & SLAB_ACCOUNT)
>>>
>>> Should this 'if' be unlikely() or should we trace cachep->flags
>>> explicitly to avoid this branch altogether?
>>
>> Hm I think ideally the tracepoint accepts cachep instead of current
>> cachep->*size parameters and does the necessary extraction and
>> modification in its fast_assign.
>
> +1 for fast_assign
>
> Changing flags just for tracing looks a bit excessive.

At the kmem_cache_alloc and kmem_alloc use the same tracing template.
Ok, I'll try to redesign this.