Re: [PATCH] rcuwait: do not enter RCU protection unless a wakeup is needed

From: Lai Jiangshan
Date: Fri Oct 22 2021 - 00:12:12 EST


On Wed, Oct 20, 2021 at 7:39 PM Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:
>
> On 20/10/21 13:17, Peter Zijlstra wrote:
> > AFAICT, rcu_read_lock() for PREEMPT_RCU is:
> >
> > WRITE_ONCE(current->rcu_read_lock_nesting, READ_ONCE(current->rcu_read_lock_nesting) + 1);
> > barrier();
>
> rcu_read_unlock() is the expensive one if you need to go down
> rcu_read_unlock_special().
>

If "actual likelihood of a wakeup is very low." as stated in the changelog,
the likelihood of rcu_read_unlock_special() is also very low.

rcu_read_lock() for PREEMPT_RCU is a function call, is it relevant?

(It is possible to remove the function call if the include-hell can
be resolved or remove the function call via LTO or just remove the
function call in X86 via percpu.)

Thanks
Lai

> Paolo
>
> > Paul?
>