From: Joel Fernandes <joel@joelfernandes.org>
To: Byungchul Park <byungchul.park@lge.com>
Cc: rcu <rcu@vger.kernel.org>, kernel-team@lge.com
Subject: Re: This percpu_rwsem that always enters its reader slow path
Date: Sun, 21 Jul 2019 09:28:42 -0400 [thread overview]
Message-ID: <20190721132842.GA4584@google.com> (raw)
In-Reply-To: <20190719075011.GD28226@X58A-UD3R>
On Fri, Jul 19, 2019 at 04:50:11PM +0900, Byungchul Park wrote:
> On Thu, Jul 18, 2019 at 05:09:45PM -0400, Joel Fernandes wrote:
> > Hello friends,
> >
> > Just providing an update on my debugging of percpu_rwsem (related to
> > rcu-sync) for the day! which I pinged Byungchul about. Please ignore
> > this email if you are busy :) I am just archiving it in here..
> >
> > As you may know, percpu_rwsem uses rcu-sync framework to reduce cost
> > of read-side by making it free of any serializing/atomic instructions
> > at all. However, there was one sempahore which broke the rules!
> >
> > I spent a couple hours trying to figure out why
> > cgroup_threadgroup_rwsem always entered the reader-slow path on my
> > system (RCU-sync turns out to be non-idle for this rwsem). I really
> > thought it was a bug, because I felt what's the pointed of rcu-sync if
> > it never goes idle..
>
> Yes, with the following patch, the cgroup rwsem cannot make use of
> rcu_sync any more, but it still gets benefit from percpu structure
> as you told me like avoiding cache bouncing and contention on a shared
> area even though every read lock keeps firing smp full barrier.
Yes. So it seems to me main benefit of RCU in percpu_rw_sempahore is to
completely avoid memory barriers in the read path, while also benefiting from
the percpu nature of the lock.
> What matters is which one is more expensive between (1) firing smp_mb
> and (2) accessing a shared data, sem->count, and acquiring/releasing
> sem->wait_lock. I think using percpu-rwsem involving the smp barrier is
> much better even with rcu_sync disabled.
Right. Fully agreed.
thanks,
- Joel
prev parent reply other threads:[~2019-07-21 13:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-18 21:09 This percpu_rwsem that always enters its reader slow path Joel Fernandes
2019-07-18 21:10 ` Joel Fernandes
2019-07-19 7:50 ` Byungchul Park
2019-07-21 13:28 ` Joel Fernandes [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=20190721132842.GA4584@google.com \
--to=joel@joelfernandes.org \
--cc=byungchul.park@lge.com \
--cc=kernel-team@lge.com \
--cc=rcu@vger.kernel.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.