Skip to content

Commit

Permalink
locking/atomic, arch/rwsem: Employ atomic_long_fetch_add()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Jun 16, 2016
1 parent f9852b7 commit 86a3b5f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/locking/rwsem-xadd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
/*
Expand Down

0 comments on commit 86a3b5f

Please sign in to comment.