From: Peter Zijlstra <peterz@infradead.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
Davidlohr Bueso <dave@stgolabs.net>,
Oleg Nesterov <oleg@redhat.com>, Ingo Molnar <mingo@kernel.org>,
"Paul E . McKenney" <paulmck@linux.vnet.ibm.com>,
Wanpeng Li <wanpengli@tencent.com>
Subject: Re: [PATCH] rcuwait: do not enter RCU protection unless a wakeup is needed
Date: Wed, 20 Oct 2021 13:17:43 +0200 [thread overview]
Message-ID: <YW/61zpycsD8/z4g@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20211020110638.797389-1-pbonzini@redhat.com>
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?
next prev parent reply other threads:[~2021-10-20 11:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-20 11:06 [PATCH] rcuwait: do not enter RCU protection unless a wakeup is needed Paolo Bonzini
2021-10-20 11:17 ` Peter Zijlstra [this message]
2021-10-20 11:37 ` Paolo Bonzini
2021-10-22 4:11 ` Lai Jiangshan
2021-10-20 11:52 ` Paolo Bonzini
[not found] ` <CANRm+CyX+ZZh+LbLPBXEfMoExkx78qHpP-=yFCop9gX+LQeWDQ@mail.gmail.com>
2021-10-20 12:04 ` Paolo Bonzini
[not found] ` <CANRm+Cxpav5FqCBZoQv5BLnC160_RA3YDJc_CFabW7oMBFQ_5g@mail.gmail.com>
2021-10-22 13:59 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YW/61zpycsD8/z4g@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=dave@stgolabs.net \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=wanpengli@tencent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox