From: Boqun Feng <boqun.feng@gmail.com>
To: Waiman Long <longman@redhat.com>
Cc: Pan Xinhui <xinhui@linux.vnet.ibm.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] locking/pvqspinlock: Relax cmpxchg's to improve performance on some archs
Date: Thu, 5 Jan 2017 23:40:34 +0800 [thread overview]
Message-ID: <20170105154034.GD15084@tardis.cn.ibm.com> (raw)
In-Reply-To: <349c5926-cd35-2313-b8a0-ebfe6eb5e4a0@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2030 bytes --]
On Thu, Jan 05, 2017 at 10:17:46AM -0500, Waiman Long wrote:
> On 01/05/2017 03:16 AM, Pan Xinhui wrote:
> >
> >
> > 在 2017/1/4 17:41, Peter Zijlstra 写道:
> >> On Tue, Jan 03, 2017 at 05:07:54PM -0500, Waiman Long wrote:
> >>> On 01/03/2017 11:18 AM, Peter Zijlstra wrote:
> >>>> On Sun, Dec 25, 2016 at 03:26:01PM -0500, Waiman Long wrote:
> >>>>> A number of cmpxchg calls in qspinlock_paravirt.h were replaced by
> >>>>> more
> >>>>> relaxed versions to improve performance on architectures that use
> >>>>> LL/SC.
> >>>> Claim without numbers ;-)
> >>>
> >>> Well it is hard to produce actual numbers here as I don't have the
> >>> setup
> >>> to gather data.
> >>
> >> Surely RHT has big PPC machines around? I know that getting to them is a
> >> wee bit of a bother, but they should be available somewhere.
> >>
> > hi,
> >
> > I do some tests about cmpxchg and cmpxchg_acquire before on ppc.
> >
> > loops in 15s of each cmpxchg is below.
> >
> > cmpxchg_relaxed: 336663
> > cmpxchg_release: 369054
> > cmpxchg_acquire: 363364
> > cmpxchg: 179435
> >
> > so cmpxchg is really expensive than others.
> > but I also have doubt about the cmpxchg_relaxed, it should be the
> > cheapest, but from the tests, release/acquire are faster than it.
> >
> > thanks
> > xinhui
> >
> Thanks for doing the test. It looks like we should just focus on using
> either cmpxchg_release or cmpxchg_acquire and forget about cmpxchg_relaxed.
>
_relaxed is more lightweight in two aspects:
1. _relaxed is not a compiler barrier, so it allows compilers do
more optimizations than _acquire and _release.
2. _relaxed doesn't introduce HW barriers and doesn't performs
worse than _acquire and _release in _most_ _usual_ cases.
And on some ll/sc archs without a lightweigt barrier like "lwsync" for
_acquire and _release, #2 could be more significant.
So don't hesitate to use _relaxed whenever it's possible and reasonable
;-)
Regards,
Boqun
> Cheers,
> Longman
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2017-01-05 15:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-25 20:26 Waiman Long
2016-12-26 5:50 ` Boqun Feng
2017-01-03 22:23 ` Waiman Long
2017-01-03 16:18 ` Peter Zijlstra
2017-01-03 22:07 ` Waiman Long
2017-01-04 9:41 ` Peter Zijlstra
2017-01-05 8:16 ` Pan Xinhui
2017-01-05 9:48 ` Peter Zijlstra
2017-01-05 9:51 ` Boqun Feng
2017-01-05 15:17 ` Waiman Long
2017-01-05 15:40 ` Boqun Feng [this message]
2017-01-05 15:30 ` Waiman Long
[not found] ` <CAH4ORazqsCBA4G5paHtsp8PMfM=J3P6rvyR-53-ZLjn=7U6J0g@mail.gmail.com>
2017-02-08 4:05 ` Boqun Feng
2017-02-08 6:09 ` Boqun Feng
2017-02-08 6:47 ` Pan Xinhui
2017-02-08 6:48 ` Pan Xinhui
2017-02-08 7:09 ` Pan Xinhui
2017-02-08 7:15 ` Boqun Feng
[not found] ` <778926a5-cf9f-586b-6bc4-b9453d88aabb@redhat.com>
2017-02-13 2:24 ` panxinhui
2017-02-13 3:19 ` Boqun Feng
2017-02-17 19:01 ` Waiman Long
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=20170105154034.GD15084@tardis.cn.ibm.com \
--to=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=xinhui@linux.vnet.ibm.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
Powered by JetHome