[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANRm+CyX+ZZh+LbLPBXEfMoExkx78qHpP-=yFCop9gX+LQeWDQ@mail.gmail.com>
Date: Wed, 20 Oct 2021 20:01:28 +0800
From: Wanpeng Li <kernellwp@...il.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>, kvm <kvm@...r.kernel.org>,
Davidlohr Bueso <dave@...olabs.net>,
Oleg Nesterov <oleg@...hat.com>,
Ingo Molnar <mingo@...nel.org>,
"Paul E . McKenney" <paulmck@...ux.vnet.ibm.com>,
Wanpeng Li <wanpengli@...cent.com>
Subject: Re: [PATCH] rcuwait: do not enter RCU protection unless a wakeup is needed
On Wed, 20 Oct 2021 at 19:53, Paolo Bonzini <pbonzini@...hat.com> wrote:
>
> On 20/10/21 13:17, Peter Zijlstra wrote:
> > On Wed, Oct 20, 2021 at 07:06:38AM -0400, Paolo Bonzini wrote:
> >> In some cases, rcuwait_wake_up can be called even if the actual likelihood
> >> of a wakeup is very low. If CONFIG_PREEMPT_RCU is active, the resulting
> >> rcu_read_lock/rcu_read_unlock pair can be relatively expensive, and in
> >> fact it is unnecessary when there is no w->task to keep alive: the
> >> memory barrier before the read is what matters in order to avoid missed
> >> wakeups.
> >>
> >> Therefore, do an early check of w->task right after the barrier, and skip
> >> rcu_read_lock/rcu_read_unlock unless there is someone waiting for a wakeup.
> >>
> >> Running kvm-unit-test/vmexit.flat with APICv disabled, most interrupt
> >> injection tests (tscdeadline*, self_ipi*, x2apic_self_ipi*) improve
> >> by around 600 cpu cycles.
> >
> > *how* ?!?
> >
> > AFAICT, rcu_read_lock() for PREEMPT_RCU is:
> >
> > WRITE_ONCE(current->rcu_read_lock_nesting, READ_ONCE(current->rcu_read_lock_nesting) + 1);
> > barrier();
> >
> > Paul?
>
> Wanpeng, can you share your full .config?
Yes, in the attachment.
Wanpeng
Download attachment "config" of type "application/octet-stream" (249852 bytes)
Powered by blists - more mailing lists