Re: [PATCH v4 1/4] mm/slub: enable debugging memory wasting of kmalloc

From: Vlastimil Babka
Date: Mon Sep 05 2022 - 03:33:23 EST


On 9/5/22 09:06, Feng Tang wrote:
> On Mon, Sep 05, 2022 at 02:29:51PM +0800, Vlastimil Babka wrote:
>>
>> How about get_partial() instantiates an on-stack structure that contains
>> gfpflags, ret_slab, orig_size and passes pointer to that to all the nested
>> functions.
>>
>> Would be similar to "struct alloc_context" in page allocation.
>> Something like "struct partial_context pc"?
>
> Yep! This would make the parameters passing much tidier. Will try
> this way.
>
> More aggressively is to also embed the 'kmem_cache' parameter into
> it, but this may make the code look ambiguous.

That one is used a lot everywhere, so it would be tedious to dereference it
from a struct, and also might be a bit better code if it's in a register.

> Thanks,
> Feng
>
>