[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251110114201.37d63a73@gandalf.local.home>
Date: Mon, 10 Nov 2025 11:42:01 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
Cc: Steven Rostedt <rostedt@...nel.org>, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, Mark Rutland <mark.rutland@....com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Andrew Morton
<akpm@...ux-foundation.org>
Subject: Re: [PATCH 2/2] tracing: Use switch statement instead of ifs in
set_tracer_flag()
On Mon, 10 Nov 2025 14:48:26 +0900
Masami Hiramatsu (Google) <mhiramat@...nel.org> wrote:
> BTW, set_tracer_flag() seems to expect to modify only one bit.
> If we can count the number of its in @mask and reject if it is
> not 1, we can use bit-mask instead of the first switch()?
>
> if (!mask || /* mask has no bit */
> (mask & ~(1 << (ffs64(mask) - 1)))) /* mask has more than 2 bits */
> return -EINVAL;
Well, this has been around for over a decade without any issues. I don't
think a check would be of much use. Not to mention, invalid masks are OK to
pass in.
If anything, I would have liked to pass in the bit number and not a mask.
But that's something we could do another time.
-- Steve
Powered by blists - more mailing lists