From: Tejun Heo <tj@kernel.org>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
Kent Overstreet <koverstreet@google.com>,
linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: A question on RCU vs. preempt-RCU
Date: Sun, 16 Jun 2013 14:40:28 -0700 [thread overview]
Message-ID: <20130616214028.GA28587@htj.dyndns.org> (raw)
In-Reply-To: <20130616141335.GW5146@linux.vnet.ibm.com>
Hello, Paul.
On Sun, Jun 16, 2013 at 07:13:35AM -0700, Paul E. McKenney wrote:
> CONFIG_TREE_PREEMPT_RCU does have an increment, decrement (sort of),
> and check in its rcu_read_lock() and rcu_read_unlock(), which will
> add overhead that might well be noticeable compared to CONFIG_TREE_RCU's
> zero-code implementation of rcu_read_lock() and rcu_read_unlock().
Yeah, I should have added one more data point. I was testing atomic_t
vs. percpu-ref and saw the overhead and worrying that it would show
regression against preempt_disable/enable() implementation.
Just ran some tests and preempt_disable/enable() based implementation
is about 18% faster than rcu_read_lock/unlock() based one.
Compared to atomic_t, in a horribly contrived test case, normal RCU
would be slower by around 20% while the preemption one would be slower
by 7.5%.
> The main source of longer latency from preempt_disable/enable()
> (or rcu_read_{,un}lock_sched()) will be on the read side.
> The callback-processing is very nearly identical.
Ah, right. I was completely confused there. The goal of
CONFIG_TREE_PREEMPT_RCU is to allow preemption inside RCU read
critical sections. I knew that at one point and completely forgot
about it, so using preemption based one is fine as long as the length
of critical section is short.
> The big question is "how long are the RCU read-side critical sections?"
Extremely short. It's gonna be like five instructions.
> My guess is that module references can have arbitrarily long lifetimes,
Preemption is disabled only while the refcnt operations are actually
going on.
> which would argue strongly against use of RCU-sched. But if the lifetimes
> are always short (say, sub-microsecond), then RCU-sched should be fine.
So, RCU-sched, it is.
Thanks a lot for the help!
--
tejun
prev parent reply other threads:[~2013-06-16 21:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-16 2:36 Tejun Heo
2013-06-16 6:46 ` Rusty Russell
2013-06-17 18:20 ` Tejun Heo
2013-06-18 5:21 ` Rusty Russell
2013-06-20 3:23 ` Steven Rostedt
2013-06-16 14:13 ` Paul E. McKenney
2013-06-16 21:40 ` Tejun Heo [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=20130616214028.GA28587@htj.dyndns.org \
--to=tj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=koverstreet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome