From: Peter Zijlstra <peterz@infradead•org>
To: Waiman Long <longman@redhat•com>
Cc: linux-arch@vger•kernel.org, linux-xtensa@linux-xtensa•org,
Davidlohr Bueso <dave@stgolabs•net>,
linux-ia64@vger•kernel.org, Tim Chen <tim.c.chen@linux•intel.com>,
Arnd Bergmann <arnd@arndb•de>,
linux-sh@vger•kernel.org, linux-hexagon@vger•kernel.org,
x86@kernel•org, Will Deacon <will.deacon@arm•com>,
linux-kernel@vger•kernel.org,
Linus Torvalds <torvalds@linux-foundation•org>,
Ingo Molnar <mingo@redhat•com>, Borislav Petkov <bp@alien8•de>,
"H. Peter Anvin" <hpa@zytor•com>,
linux-alpha@vger•kernel.org, sparclinux@vger•kernel.org,
Thomas Gleixner <tglx@linutronix•de>,
linuxppc-dev@lists•ozlabs.org,
Andrew Morton <akpm@linux-foundation•org>,
linux-arm-kernel@lists•infradead.org
Subject: Re: [PATCH] locking/rwsem: Remove arch specific rwsem files
Date: Mon, 11 Feb 2019 10:40:44 +0100 [thread overview]
Message-ID: <20190211094044.GG32534@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190211093601.GT32511@hirez.programming.kicks-ass.net>
On Mon, Feb 11, 2019 at 10:36:01AM +0100, Peter Zijlstra wrote:
> On Sun, Feb 10, 2019 at 09:00:50PM -0500, Waiman Long wrote:
> > +static inline int __down_read_trylock(struct rw_semaphore *sem)
> > +{
> > + long tmp;
> > +
> > + while ((tmp = atomic_long_read(&sem->count)) >= 0) {
> > + if (tmp == atomic_long_cmpxchg_acquire(&sem->count, tmp,
> > + tmp + RWSEM_ACTIVE_READ_BIAS)) {
> > + return 1;
>
> That really wants to be:
>
> if (atomic_long_try_cmpxchg_acquire(&sem->count, &tmp,
> tmp + RWSEM_ACTIVE_READ_BIAS))
>
> > + }
> > + }
> > + return 0;
> > +}
Also, the is the one case where LL/SC can actually do 'better'. Do you
have benchmarks for say PowerPC or ARM64 ?
next prev parent reply other threads:[~2019-02-11 9:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-11 2:00 [PATCH] locking/rwsem: Remove arch specific rwsem files Waiman Long
2019-02-11 2:08 ` Waiman Long
2019-02-11 7:11 ` Ingo Molnar
2019-02-11 10:39 ` Ingo Molnar
2019-02-11 10:52 ` Will Deacon
2019-02-11 10:55 ` Ingo Molnar
2019-02-11 13:32 ` Waiman Long
2019-02-11 9:36 ` Peter Zijlstra
2019-02-11 9:40 ` Peter Zijlstra [this message]
2019-02-11 10:57 ` Peter Zijlstra
2019-02-11 11:58 ` Peter Zijlstra
2019-02-11 16:35 ` Waiman Long
2019-02-11 17:04 ` 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=20190211094044.GG32534@hirez.programming.kicks-ass.net \
--to=peterz@infradead$(echo .)org \
--cc=akpm@linux-foundation$(echo .)org \
--cc=arnd@arndb$(echo .)de \
--cc=bp@alien8$(echo .)de \
--cc=dave@stgolabs$(echo .)net \
--cc=hpa@zytor$(echo .)com \
--cc=linux-alpha@vger$(echo .)kernel.org \
--cc=linux-arch@vger$(echo .)kernel.org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-hexagon@vger$(echo .)kernel.org \
--cc=linux-ia64@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-sh@vger$(echo .)kernel.org \
--cc=linux-xtensa@linux-xtensa$(echo .)org \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=longman@redhat$(echo .)com \
--cc=mingo@redhat$(echo .)com \
--cc=sparclinux@vger$(echo .)kernel.org \
--cc=tglx@linutronix$(echo .)de \
--cc=tim.c.chen@linux$(echo .)intel.com \
--cc=torvalds@linux-foundation$(echo .)org \
--cc=will.deacon@arm$(echo .)com \
--cc=x86@kernel$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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