linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@kernel.org>,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	Mark Rutland <mark.rutland@arm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/2] tracing: Use switch statement instead of ifs in set_tracer_flag()
Date: Mon, 10 Nov 2025 11:42:01 -0500	[thread overview]
Message-ID: <20251110114201.37d63a73@gandalf.local.home> (raw)
In-Reply-To: <20251110144826.8d92d83af67efebac2a3ecf5@kernel.org>

On Mon, 10 Nov 2025 14:48:26 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.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

      reply	other threads:[~2025-11-10 16:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-06  0:33 [PATCH 0/2] tracing: Clean up of set_tracer_flag() Steven Rostedt
2025-11-06  0:33 ` [PATCH 1/2] tracing: Exit out immediately after update_marker_trace() Steven Rostedt
2025-11-10  5:24   ` Masami Hiramatsu
2025-11-06  0:33 ` [PATCH 2/2] tracing: Use switch statement instead of ifs in set_tracer_flag() Steven Rostedt
2025-11-10  5:48   ` Masami Hiramatsu
2025-11-10 16:42     ` 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=20251110114201.37d63a73@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@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;
as well as URLs for NNTP newsgroup(s).