[PATCH -v2 33/33] locking,rwsem: Employ atomic_long_fetch_add()
From: Peter Zijlstra
Date: Tue May 31 2016 - 06:31:58 EST
- Next message: Peter Zijlstra: "[PATCH -v2 24/33] locking,x86: Implement atomic{,64}_fetch_{add,sub,and,or,xor}()"
- Previous message: Ian Abbott: "Re: [PATCH v2 4/4] Staging: comedi: fix line over 80 characters issue in s626.c"
- In reply to: Peter Zijlstra: "[PATCH -v2 27/33] locking: Implement atomic{,64,_long}_fetch_{add,sub,and,andnot,or,xor}{,_relaxed,_acquire,_release}()"
- Next in thread: Peter Zijlstra: "[PATCH -v2 24/33] locking,x86: Implement atomic{,64}_fetch_{add,sub,and,or,xor}()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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)) {
/*
- Next message: Peter Zijlstra: "[PATCH -v2 24/33] locking,x86: Implement atomic{,64}_fetch_{add,sub,and,or,xor}()"
- Previous message: Ian Abbott: "Re: [PATCH v2 4/4] Staging: comedi: fix line over 80 characters issue in s626.c"
- In reply to: Peter Zijlstra: "[PATCH -v2 27/33] locking: Implement atomic{,64,_long}_fetch_{add,sub,and,andnot,or,xor}{,_relaxed,_acquire,_release}()"
- Next in thread: Peter Zijlstra: "[PATCH -v2 24/33] locking,x86: Implement atomic{,64}_fetch_{add,sub,and,or,xor}()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]