From: Wen Congyang <wency@cn.fujitsu.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] rcu: optimize rcu_read_lock
Date: Thu, 17 Dec 2015 09:16:57 +0800 [thread overview]
Message-ID: <56720D09.1080908@cn.fujitsu.com> (raw)
In-Reply-To: <1450265542-4323-1-git-send-email-pbonzini@redhat.com>
On 12/16/2015 07:32 PM, Paolo Bonzini wrote:
> rcu_read_lock cannot change rcu_gp_ongoing from true to false
> (the previous value of p_rcu_reader->ctr is zero), hence
> there is no need to check p_rcu_reader->waiting and wake up
> a concurrent synchronize_rcu.
>
> While at it mark the wakeup as unlikely in rcu_read_unlock.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Wen Congyang <wency@cn.fujitsu.com>
> ---
> include/qemu/rcu.h | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h
> index f6d1d56..7c7cca7 100644
> --- a/include/qemu/rcu.h
> +++ b/include/qemu/rcu.h
> @@ -88,10 +88,6 @@ static inline void rcu_read_lock(void)
>
> ctr = atomic_read(&rcu_gp_ctr);
> atomic_xchg(&p_rcu_reader->ctr, ctr);
> - if (atomic_read(&p_rcu_reader->waiting)) {
> - atomic_set(&p_rcu_reader->waiting, false);
> - qemu_event_set(&rcu_gp_event);
> - }
> }
>
> static inline void rcu_read_unlock(void)
> @@ -104,7 +100,7 @@ static inline void rcu_read_unlock(void)
> }
>
> atomic_xchg(&p_rcu_reader->ctr, 0);
> - if (atomic_read(&p_rcu_reader->waiting)) {
> + if (unlikely(atomic_read(&p_rcu_reader->waiting))) {
> atomic_set(&p_rcu_reader->waiting, false);
> qemu_event_set(&rcu_gp_event);
> }
>
prev parent reply other threads:[~2015-12-17 1:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-16 11:32 [Qemu-devel] [PATCH] rcu: optimize rcu_read_lock Paolo Bonzini
2015-12-17 1:16 ` Wen Congyang [this message]
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=56720D09.1080908@cn.fujitsu.com \
--to=wency@cn.fujitsu.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.