Re: [linus:master] [rcu/nocb] 7625926086: WARNING:at_kernel/rcu/tree_nocb.h:#rcu_nocb_try_bypass

From: Paul E. McKenney
Date: Wed Jul 12 2023 - 16:48:23 EST


On Wed, Jul 12, 2023 at 06:59:38PM +0200, Frederic Weisbecker wrote:
> On Tue, Jul 11, 2023 at 09:41:58AM -0700, Paul E. McKenney wrote:
> > On Tue, Jul 11, 2023 at 06:06:11PM +0200, Frederic Weisbecker wrote:
> > Heh!
> >
> > The purpose was to see if this lock was ever contended. I guess we now
> > have an answer, which is "Yes, but rarely."
> >
> > It looks like the victim commit increased the size of the ->nocb_lock
> > critical section, just enough to make this happen sometimes.
> >
> > Removing the WARN_ON_ONCE() seems appropriate, especially given that
> > this only happens when shrinking.
>
> Ok, I'll check that.
>
> > Should we add something that monitors that lock's contention? It is
> > often the case that lock contention rises over time as new features and
> > optimizations are added.
>
> I'm not sure. Should we keep the current ->nocb_lock_contended based engine
> to report contention somehow somewhere? Also does it behave better than our
> current spinlock slow path implementations?

The current spinlock slow path implementations try to be fair, and here
we want to favor the things dequeuing from ->cblist over those enqueuing
to it. The idea is to slow down the enqueuing when things get busy.

But to your point, given the rarity of contention, is this a real problem
needing to be solved? My queuing-theory studies and experiences argue
strenuously in favor of keeping it, but maybe there is a better way.

Thanx, Paul