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.

Something like:

diff --git a/arch/alpha/include/asm/rwsem.h b/arch/alpha/include/asm/rwsem.h
index a217bf8..77873d0 100644
--- 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 = sem->count.counter;
+       sem->count.counter += RWSEM_ACTIVE_READ_BIAS;
 #else
        long temp;
        __asm__ __volatile__(

preserves the intent.


Reply via email to