Re: [RFC][PATCH 0/7] locking/rwsem: Convert rwsem count to atomic_long_t

From: Jason Low
Date: Fri Jun 03 2016 - 19:05:34 EST


On Sat, 2016-06-04 at 00:36 +0200, Peter Zijlstra wrote:
> On Fri, Jun 03, 2016 at 11:09:54AM -0700, Jason Low wrote:
> > --- a/arch/alpha/include/asm/rwsem.h
> > +++ b/arch/alpha/include/asm/rwsem.h
> > @@ -25,8 +25,8 @@ static inline void __down_read(struct rw_semaphore *sem)
> > {
> > long oldcount;
> > #ifndef CONFIG_SMP
> > - oldcount = sem->count;
> > - sem->count += RWSEM_ACTIVE_READ_BIAS;
> > + oldcount = atomic_long_read(&sem->count);
> > + atomic_long_add(RWSEM_ACTIVE_READ_BIAS, &sem->count);
> > #else
>
> That _completely_ misses the point of the whole !SMP code.

Oh right, this defeats the purpose of the additional code path. Might as
well have removed the code entirely :\

I can send out a new patch assuming we're still keeping all the arch/*/
rwsem.h?