Re: [patch RFC] mm/slab: introduce KZALLOC_FREE() cleanup-ed allocation macro
From: Jiri Pirko
Date: Sat Mar 16 2024 - 11:41:24 EST
Fri, Mar 15, 2024 at 10:39:02PM CET, rientjes@xxxxxxxxxx wrote:
>On Fri, 15 Mar 2024, Jiri Pirko wrote:
>
>> From: Jiri Pirko <jiri@xxxxxxxxxx>
>>
>> With introduction of __free() macro using cleanup infrastructure, it
>> will very likely become quite common to see following pattern:
>> type *var __free(kfree) = kzalloc(sizeof(*var), GFP_KERNEL);
>>
>> To follow the CLASS() flow from cleanup.h, introduce a simple macro
>> KZALLOC_FREE() to wrap this over and allow the same flow.
>>
>> Show an example usage in gpio-sim driver.
>>
>
>Seems highly specialized especially for kzalloc specifically, so not sure
>this warrants its own macro.
Yeah, but having like 2-3 macro variants would probably cover vast
majority of usecases now. The rest could still do things manually.