[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251018000130.aa69bd5b6670715b1c52d387@kernel.org>
Date: Sat, 18 Oct 2025 00:01:30 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Mark Rutland <mark.rutland@....com>, Mathieu Desnoyers
<mathieu.desnoyers@...icios.com>, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/2] tracing: Allow tracer to add more than 32
options
On Wed, 15 Oct 2025 17:20:20 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
> On Tue, 30 Sep 2025 07:34:53 +0900
> "Masami Hiramatsu (Google)" <mhiramat@...nel.org> wrote:
>
> > --- a/kernel/trace/trace.c
> > +++ b/kernel/trace/trace.c
> > @@ -86,6 +86,11 @@ void __init disable_tracing_selftest(const char *reason)
> > #define tracing_selftest_disabled 0
> > #endif
> >
> > +/* Define TRACE_ITER_* flags. */
> > +#undef C
> > +#define C(a, b) const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
> > +TRACE_FLAGS
> > +
>
>
>
> > #undef C
> > -#define C(a, b) TRACE_ITER_##a = (1 << TRACE_ITER_##a##_BIT)
> > +#define C(a, b) extern const u64 TRACE_ITER_##a;
> >
> > -enum trace_iterator_flags { TRACE_FLAGS };
> > +TRACE_FLAGS
> > +#undef C
>
> Why all this work when this could have been simply fixed with a:
>
> -enum trace_iterator_flags { TRACE_FLAGS };
> +enum64 trace_iterator_flags { TRACE_FLAGS };
>
> ?
I could not find any other enum64 usage, so I doubt it is
available. (Does it depend on compiler?)
It seems C23 standard support it...
>
> Not to mention, using const u64 requires saving these numbers in an address
> and referencing them, instead of doing it inlined in text. That is, using
> u64 instead of enum64 is both slower and wastes more memory.
Yeah, I expected that the compiler could easily optimize correctly, but
maybe not?
Thank you,
>
> -- Steve
>
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists