rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: FUJITA Tomonori <fujita.tomonori@gmail.com>
Cc: jens.korinth@tuta.io, miguel.ojeda.sandonis@gmail.com,
	rust-for-linux@vger.kernel.org, ojeda@kernel.org,
	alex.gaynor@gmail.com, gary@garyguo.net,
	bjorn3_gh@protonmail.com, benno.lossin@proton.me,
	a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu
Subject: Re: [PATCH v1] rust: Add pr_*_once macros
Date: Sun, 3 Nov 2024 22:08:13 -0800	[thread overview]
Message-ID: <ZyhkzafudRiL4H39@Boquns-Mac-mini.local> (raw)
In-Reply-To: <20241104.111512.1370021952355538395.fujita.tomonori@gmail.com>

On Mon, Nov 04, 2024 at 11:15:12AM +0900, FUJITA Tomonori wrote:
> On Sun, 3 Nov 2024 23:29:29 +0100 (CET)
> jens.korinth@tuta.io wrote:
> 
> >> Hmm... Isn't this derived from what Jens was working on in Zulip? (Cc'd)
> >>
> > Looks very similar. But more importantly it's missing the hotpath
> > improvement suggested by Boqun Feng, which improves the perfomance
> > significantly:
> 
> I think that it's better to start with the very basic code and then
> optimize it with commit log that includes benchmark results.

I don't think that is necessary, if you look at how DO_ONCE_LITE_IF is
implemented today in C, it already has the load for checking:

	if (unlikely(__ret_cond && !__already_done)) {

you will just need to use atomics to fix the data race issues in C, and
the xchg() to fix the "not exactly once" issue.

Regards,
Boqun

  reply	other threads:[~2024-11-04  6:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-03  3:05 [PATCH v1] rust: Add pr_*_once macros FUJITA Tomonori
2024-11-03 16:38 ` Dirk Behme
2024-11-04  1:48   ` FUJITA Tomonori
2024-11-03 16:41 ` Miguel Ojeda
2024-11-03 22:29   ` jens.korinth
2024-11-04  2:15     ` FUJITA Tomonori
2024-11-04  6:08       ` Boqun Feng [this message]
2024-11-04  2:08   ` FUJITA Tomonori
2024-11-04 15:44     ` Miguel Ojeda
2024-11-04 22:08       ` jens.korinth
2024-11-04 22:20         ` Boqun Feng
2024-11-04 23:33         ` FUJITA Tomonori
2024-11-05 20:20           ` Miguel Ojeda
2024-11-05 23:33             ` FUJITA Tomonori
2024-11-05 20:35         ` Miguel Ojeda
2024-11-05 23:31           ` FUJITA Tomonori

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=ZyhkzafudRiL4H39@Boquns-Mac-mini.local \
    --to=boqun.feng@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=fujita.tomonori@gmail.com \
    --cc=gary@garyguo.net \
    --cc=jens.korinth@tuta.io \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /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).