public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
	rcu@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@meta.com, rostedt@goodmis.org, andrii@kernel.org
Subject: Re: [PATCH rcu] srcu: Guarantee non-negative return value from srcu_read_lock()
Date: Tue, 22 Oct 2024 09:10:18 +0200	[thread overview]
Message-ID: <20241022071018.GA16066@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <ZxdPN6wT1LMyLaNL@infradead.org>

On Tue, Oct 22, 2024 at 12:07:35AM -0700, Christoph Hellwig wrote:
> On Tue, Oct 22, 2024 at 09:06:35AM +0200, Peter Zijlstra wrote:
> > What is returned is an array index -- and SRCU is currently built using
> > an array of size 2. Using larger arrays is conceivable (IIRC some
> > versions of preemptible RCU used up to 4 or something).
> > 
> > So while the values 0,1 are possible inside bool, that does not reflect
> > the nature of the numbers, which is an array index. Mapping that onto
> > bool would be slightly confusing (and limit possible future extention of
> > using larger arrays for SRCU).
> 
> Ok, make sense.  Maybe add this to the comment if we're updating іt.
> But using an unsigned return value might still be useful.

Ah, well, the thing that got us here is that we (Andrii and me) wanted
to use -1 as an 'invalid' value to indicate SRCU is not currently in
use.

So it all being int is really rather convenient :-)

  reply	other threads:[~2024-10-22  7:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21 22:13 [PATCH rcu] srcu: Guarantee non-negative return value from srcu_read_lock() Paul E. McKenney
2024-10-21 23:50 ` Andrii Nakryiko
2024-10-22  0:21   ` Paul E. McKenney
2024-10-22  2:01     ` Andrii Nakryiko
2024-10-22  3:30       ` Paul E. McKenney
2024-10-22  3:40         ` Andrii Nakryiko
2024-10-22  7:07         ` Peter Zijlstra
2024-10-22 14:27           ` Paul E. McKenney
2024-10-22  6:51 ` Christoph Hellwig
2024-10-22  7:06   ` Peter Zijlstra
2024-10-22  7:07     ` Christoph Hellwig
2024-10-22  7:10       ` Peter Zijlstra [this message]
2024-10-22  7:13         ` Christoph Hellwig
2024-10-22 14:26           ` Paul E. McKenney
2024-10-22 17:29             ` Andrii Nakryiko
2024-10-23  6:40               ` Christoph Hellwig
2024-10-23 16:34                 ` Andrii Nakryiko
2024-10-23 16:46                   ` Alan Huang
2024-10-23 16:59                     ` Andrii Nakryiko
2024-10-23  6:58             ` Alan Huang
2024-10-23 16:40               ` Paul E. McKenney
2024-10-23 16:56                 ` Alan Huang

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=20241022071018.GA16066@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=andrii@kernel.org \
    --cc=hch@infradead.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.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