Re: [PATCH] locking/rwsem: Remove arch specific rwsem files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Waiman Long <longman@xxxxxxxxxx>
- Subject: Re: [PATCH] locking/rwsem: Remove arch specific rwsem files
- From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
- Date: Mon, 11 Feb 2019 11:57:29 +0100
- Cc: Ingo Molnar <mingo@xxxxxxxxxx>, Will Deacon <will.deacon@xxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-hexagon@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, linux-arch@xxxxxxxxxxxxxxx, x86@xxxxxxxxxx, Arnd Bergmann <arnd@xxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Davidlohr Bueso <dave@xxxxxxxxxxxx>, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
- In-reply-to: <20190211094044.GG32534@hirez.programming.kicks-ass.net>
- References: <1549850450-10171-1-git-send-email-longman@redhat.com> <20190211093601.GT32511@hirez.programming.kicks-ass.net> <20190211094044.GG32534@hirez.programming.kicks-ass.net>
- User-agent: Mutt/1.10.1 (2018-07-13)
On Mon, Feb 11, 2019 at 10:40:44AM +0100, Peter Zijlstra wrote:
> 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 ?
Ah, I see they already used asm-generic/rwsem.h which has similar code
to the above.
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]