Linux Trace Kernel
 help / color / mirror / Atom feed
From: Gabriele Monaco <gmonaco@redhat.com>
To: Tobias Schaffner <tobias.schaffner@siemens.com>,
	Steven Rostedt <rostedt@goodmis.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	 Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Jan Kiszka	 <jan.kiszka@siemens.com>,
	Philippe Gerum <rpm@xenomai.org>,
	 linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	 linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC 1/3] rv: add per-edge dwell-time statistics primitive
Date: Tue, 01 Sep 2026 09:37:28 +0200	[thread overview]
Message-ID: <0b0b115713a6d5a10d719085284dc7cef21ed892.camel@redhat.com> (raw)
In-Reply-To: <20260827072400.45734-2-tobias.schaffner@siemens.com>

On Thu, 2026-08-27 at 09:23 +0200, Tobias Schaffner wrote:
> +	while (dwell_ns > (u64)max) {
> +		s64 prev = local64_cmpxchg(&s->max_ns, max, dwell_ns);
> +
> +		if (prev == max)
> +			break;
> +		max = prev;
> +	}

try_cmpxchg() functions produce arguably cleaner code, would you mind doing:

  while (dwell_ns > (u64)max) {
      if (local64_try_cmpxchg(&s->max_ns, &max, dwell_ns))
          break;
  }

Also, although issues are practically impossible, I'd avoid an unbound loop in
hot paths, you could go up to MAX_DA_RETRY_RACING_EVENTS (already existing in
da_monitor) and put some warning in case you reach the maximum amount of
retries.

Thanks,
Gabriele


  parent reply	other threads:[~2026-09-01  7:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27  7:23 [RFC 0/3] rv: per-edge dwell-time statistics for per-cpu monitors Tobias Schaffner
2026-08-27  7:23 ` [RFC 1/3] rv: add per-edge dwell-time statistics primitive Tobias Schaffner
2026-08-27  7:34   ` sashiko-bot
2026-08-27  8:22   ` Gabriele Monaco
2026-08-27 10:10     ` Tobias Schaffner
2026-09-01  7:37   ` Gabriele Monaco [this message]
2026-08-27  7:23 ` [RFC 2/3] rv: add per-monitor edge-stat facility and stats file Tobias Schaffner
2026-08-27  7:39   ` sashiko-bot
2026-08-31 15:20   ` Gabriele Monaco
2026-08-27  7:24 ` [RFC 3/3] rv: collect per-edge dwell time for per-cpu DA/HA monitors Tobias Schaffner
2026-08-27  7:37   ` sashiko-bot
2026-08-27  8:18 ` [RFC 0/3] rv: per-edge dwell-time statistics for per-cpu monitors Gabriele Monaco
2026-08-27 18:21   ` Tobias Schaffner

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=0b0b115713a6d5a10d719085284dc7cef21ed892.camel@redhat.com \
    --to=gmonaco@redhat.com \
    --cc=corbet@lwn.net \
    --cc=jan.kiszka@siemens.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=rpm@xenomai.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tobias.schaffner@siemens.com \
    /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