Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

From: Jason Gunthorpe
Date: Mon Jul 22 2019 - 09:41:57 EST

On Mon, Jul 22, 2019 at 04:51:49AM -0700, Paul E. McKenney wrote:

> > > > Would it make sense to have call_rcu() check to see if there are many
> > > > outstanding requests on this CPU and if so process them before returning?
> > > > That would ensure that frequent callers usually ended up doing their
> > > > own processing.
> > >
> > > Unfortunately, no. Here is a code fragment illustrating why:

That is only true in the general case though, kfree_rcu() doesn't have
this problem since we know what the callback is doing. In general a
caller of kfree_rcu() should not need to hold any locks while calling

We could apply the same idea more generally and have some
'call_immediate_or_rcu()' which has restrictions on the caller's

I think if we have some kind of problem here it would be better to
handle it inside the core code and only require that callers use the
correct RCU API.

I can think of many places where kfree_rcu() is being used under user