[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250804102018.56efd19a@gandalf.local.home>
Date: Mon, 4 Aug 2025 10:20:18 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Linux Trace Kernel
<linux-trace-kernel@...r.kernel.org>, bpf@...r.kernel.org, Mathieu
Desnoyers <mathieu.desnoyers@...icios.com>, Alexei Starovoitov
<ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko
<andrii@...nel.org>, Jiri Olsa <jolsa@...nel.org>, Martin KaFai Lau
<martin.lau@...ux.dev>, Eduard Zingerman <eddyz87@...il.com>, Song Liu
<song@...nel.org>, KP Singh <kpsingh@...nel.org>
Subject: Re: [PATCH] btf: Simplify BTF logic with use of __free(btf_put)
On Mon, 4 Aug 2025 22:26:45 +0900
Masami Hiramatsu (Google) <mhiramat@...nel.org> wrote:
> On Fri, 1 Aug 2025 07:16:22 -0400
> Steven Rostedt <rostedt@...dmis.org> wrote:
>
> > From: Steven Rostedt <rostedt@...dmis.org>
> >
> > Several functions need to call btf_put() on the btf pointer before it
> > returns leading to using "goto" branches to jump to the end to call
> > btf_put(btf). This can be simplified by introducing DEFINE_FREE() to allow
> > functions to define the btf descriptor with:
> >
> > struct btf *btf __free(btf_put) = NULL;
> >
> > Then the btf descriptor will always have btf_put() called on it if it
> > isn't NULL or ERR before exiting the function.
> >
> > Where needed, no_free_ptr(btf) is used to assign the btf descriptor to a
> > pointer that will be used outside the function.
> >
>
> Yeah, this looks good to me.
>
> Acked-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
Thanks but Alexei already declined it.
I'm gonna respin where it is only used in the tracing code.
Thanks!
-- Steve
Powered by blists - more mailing lists