public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 1/1] remove redundant compare, cmpxchg already does it
@ 2014-06-04 20:38 Pranith Kumar
  2014-06-04 20:56 ` Andev
  0 siblings, 1 reply; 7+ messages in thread
From: Pranith Kumar @ 2014-06-04 20:38 UTC (permalink / raw)
  To: peterz; +Cc: linux-kernel

remove a redundant comparision

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 kernel/locking/rwsem-xadd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c
index 1f99664b..6f8bd3c 100644
--- a/kernel/locking/rwsem-xadd.c
+++ b/kernel/locking/rwsem-xadd.c
@@ -249,8 +249,7 @@ static inline bool rwsem_try_write_lock(long count, struct rw_semaphore *sem)
 {
     if (!(count & RWSEM_ACTIVE_MASK)) {
         /* try acquiring the write lock */
-        if (sem->count == RWSEM_WAITING_BIAS &&
-            cmpxchg(&sem->count, RWSEM_WAITING_BIAS,
+        if (cmpxchg(&sem->count, RWSEM_WAITING_BIAS,
                 RWSEM_ACTIVE_WRITE_BIAS) == RWSEM_WAITING_BIAS) {
             if (!list_is_singular(&sem->wait_list))
                 rwsem_atomic_update(RWSEM_WAITING_BIAS, sem);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-06-06  7:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-04 20:38 [RFC PATCH 1/1] remove redundant compare, cmpxchg already does it Pranith Kumar
2014-06-04 20:56 ` Andev
2014-06-05  7:22   ` Peter Zijlstra
2014-06-05 17:54     ` Davidlohr Bueso
2014-06-05 18:08       ` Davidlohr Bueso
2014-06-06  7:01         ` Peter Zijlstra
2014-06-06  3:09     ` Pranith Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox