locking/atomic, arch/rwsem: Employ atomic_long_fetch_add()
authorPeter Zijlstra <peterz@infradead.org>
Wed, 18 May 2016 10:42:21 +0000 (12:42 +0200)
committerIngo Molnar <mingo@kernel.org>
Thu, 16 Jun 2016 08:48:35 +0000 (10:48 +0200)
Now that we have fetch_add() we can stop using add_return() - val.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jason Low <jason.low2@hpe.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Waiman Long <waiman.long@hpe.com>
Cc: linux-arch@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/locking/rwsem-xadd.c

index 2031281bb940486c6930073f897af49559c0baaa..447e08de1fabf11b3d2050c5735a0ea331362fc4 100644 (file)
@@ -153,7 +153,7 @@ __rwsem_mark_wake(struct rw_semaphore *sem,
        if (wake_type != RWSEM_WAKE_READ_OWNED) {
                adjustment = RWSEM_ACTIVE_READ_BIAS;
  try_reader_grant:
-               oldcount = atomic_long_add_return(adjustment, &sem->count) - adjustment;
+               oldcount = atomic_long_fetch_add(adjustment, &sem->count);
 
                if (unlikely(oldcount < RWSEM_WAITING_BIAS)) {
                        /*