From: Steven Rostedt <rostedt@goodmis.org>
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>,
bpf@vger.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
KP Singh <kpsingh@kernel.org>
Subject: Re: [PATCH] btf: Simplify BTF logic with use of __free(btf_put)
Date: Mon, 4 Aug 2025 10:20:18 -0400 [thread overview]
Message-ID: <20250804102018.56efd19a@gandalf.local.home> (raw)
In-Reply-To: <20250804222645.5d8dd9895812b31e7a6963e9@kernel.org>
On Mon, 4 Aug 2025 22:26:45 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> On Fri, 1 Aug 2025 07:16:22 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > From: Steven Rostedt <rostedt@goodmis.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@kernel.org>
Thanks but Alexei already declined it.
I'm gonna respin where it is only used in the tracing code.
Thanks!
-- Steve
prev parent reply other threads:[~2025-08-04 14:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-01 11:16 [PATCH] btf: Simplify BTF logic with use of __free(btf_put) Steven Rostedt
2025-08-01 15:02 ` Alexei Starovoitov
2025-08-01 15:07 ` Steven Rostedt
2025-08-01 15:12 ` Alexei Starovoitov
2025-08-01 15:19 ` Steven Rostedt
2025-08-01 15:28 ` Alexei Starovoitov
2025-08-01 15:34 ` Tomas Glozar
2025-08-01 15:56 ` Steven Rostedt
2025-08-01 15:59 ` Tomas Glozar
2025-08-04 13:26 ` Masami Hiramatsu
2025-08-04 14:20 ` Steven Rostedt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250804102018.56efd19a@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=song@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox