On Wed, 15 Oct 2025 17:20:20 -0400
Steven Rostedt <[email protected]> wrote:

> On Tue, 30 Sep 2025 07:34:53 +0900
> "Masami Hiramatsu (Google)" <[email protected]> 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) <[email protected]>

Reply via email to