[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQ+fz7DQ9O=4F-4NNo1J7=dkiDAfYa+Fc5WXBK0yH0f=TQ@mail.gmail.com>
Date: Thu, 16 Jan 2025 13:00:24 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: "Paul E. McKenney" <paulmck@...nel.org>
Cc: rcu@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
Kernel Team <kernel-team@...a.com>, Steven Rostedt <rostedt@...dmis.org>,
Alexei Starovoitov <ast@...nel.org>, Andrii Nakryiko <andrii@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, Kent Overstreet <kent.overstreet@...ux.dev>,
bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH rcu 13/17] srcu: Add SRCU-fast readers
On Thu, Jan 16, 2025 at 12:21 PM Paul E. McKenney <paulmck@...nel.org> wrote:
>
> +/*
> + * Counts the new reader in the appropriate per-CPU element of the
> + * srcu_struct. Returns a pointer that must be passed to the matching
> + * srcu_read_unlock_fast().
> + *
> + * Note that this_cpu_inc() is an RCU read-side critical section either
> + * because it disables interrupts, because it is a single instruction,
> + * or because it is a read-modify-write atomic operation, depending on
> + * the whims of the architecture.
> + */
> +static inline struct srcu_ctr __percpu *__srcu_read_lock_fast(struct srcu_struct *ssp)
> +{
> + struct srcu_ctr __percpu *scp = READ_ONCE(ssp->srcu_ctrp);
> +
> + RCU_LOCKDEP_WARN(!rcu_is_watching(), "RCU must be watching srcu_read_lock_fast().");
> + this_cpu_inc(scp->srcu_locks.counter); /* Y */
> + barrier(); /* Avoid leaking the critical section. */
> + return scp;
> +}
This doesn't look fast.
If I'm reading this correctly,
even with debugs off RCU_LOCKDEP_WARN() will still call
rcu_is_watching() and this doesn't look cheap or fast.
Powered by blists - more mailing lists