[PATCH -v2 33/33] locking,rwsem: Employ atomic_long_fetch_add()

From: Peter Zijlstra
Date: Tue May 31 2016 - 06:31:58 EST


Now that we have fetch_add() we can stop using add_return() - val.

Cc: Jason Low <jason.low2@xxxxxxx>
Cc: Waiman Long <waiman.long@xxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
kernel/locking/rwsem-xadd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/locking/rwsem-xadd.c
+++ b/kernel/locking/rwsem-xadd.c
@@ -153,7 +153,7 @@ __rwsem_mark_wake(struct rw_semaphore *s
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)) {
/*