Re: [PATCH] btf: Simplify BTF logic with use of __free(btf_put)

Steven Rostedt
2025-08-01T15:19:03Z

On Fri, 1 Aug 2025 08:12:08 -0700
Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:

>
> You can use it in kernel/trace/trace_output.c, of course,

I guess that means I should just use the DEFINE_FREE() in that file
directly and not in the btf.h header file?

> but I really think it's a step back in maintainability.
> All this cleanup.h is not a silver bullet. It needs to be used sparingly.

I have my reservations about the cleanup.h code too. But the more I use it,
the more I like it. My biggest worry is guard() leak. That is, having a
lock or interrupt/preemption disabled for longer than they need to be,
because code was added at the end of the function after the protection is
needed.

-- Steve