Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1384919

[RFC][PATCH 31/31] locking,qrwlock: Employ atomic_fetch_add_acquire()

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject [RFC][PATCH 31/31] locking,qrwlock: Employ atomic_fetch_add_acquire()
Date 2016-04-22 12:10 +0200
Message-ID <rqGcc-hy-57@gated-at.bofh.it> (permalink)
References <rqFSN-8hs-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The only reason for the current code is to make GCC emit only the
"LOCK XADD" instruction on x86 (and not do a pointless extra ADD on
the result), do so nicer.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 kernel/locking/qrwlock.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/locking/qrwlock.c
+++ b/kernel/locking/qrwlock.c
@@ -93,7 +93,7 @@ void queued_read_lock_slowpath(struct qr
 	 * that accesses can't leak upwards out of our subsequent critical
 	 * section in the case that the lock is currently held for write.
 	 */
-	cnts = atomic_add_return_acquire(_QR_BIAS, &lock->cnts) - _QR_BIAS;
+	cnts = atomic_fetch_add_acquire(_QR_BIAS, &lock->cnts);
 	rspin_until_writer_unlock(lock, cnts);
 
 	/*

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[RFC][PATCH 00/31] implement atomic_fetch_$op Peter Zijlstra <peterz@infradead.org> - 2016-04-22 12:10 +0200
  [RFC][PATCH 10/31] locking,hexagon: Implement atomic_fetch_{add,sub,and,or,xor}() Peter Zijlstra <peterz@infradead.org> - 2016-04-22 12:10 +0200
    Re: [RFC][PATCH 10/31] locking,hexagon: Implement  atomic_fetch_{add,sub,and,or,xor}() Peter Zijlstra <peterz@infradead.org> - 2016-04-23 04:20 +0200
      Re: [RFC][PATCH 10/31] locking,hexagon: Implement  atomic_fetch_{add,sub,and,or,xor}() Richard Kuo <rkuo@codeaurora.org> - 2016-04-26 02:40 +0200
  [RFC][PATCH 22/31] locking,tile: Implement atomic{,64}_fetch_{add,sub,and,or,xor}() Peter Zijlstra <peterz@infradead.org> - 2016-04-22 12:10 +0200
    Re: [RFC][PATCH 22/31] locking,tile: Implement  atomic{,64}_fetch_{add,sub,and,or,xor}() Peter Zijlstra <peterz@infradead.org> - 2016-04-26 17:30 +0200
  [RFC][PATCH 31/31] locking,qrwlock: Employ atomic_fetch_add_acquire() Peter Zijlstra <peterz@infradead.org> - 2016-04-22 12:10 +0200

csiph-web