From: Pranith Kumar <pranith@gatech.edu>
To: peterz@infradead.org
Cc: linux-kernel@vger.kernel.org
Subject: [RFC PATCH 1/1] remove redundant compare, cmpxchg already does it
Date: Wed, 04 Jun 2014 16:38:55 -0400 [thread overview]
Message-ID: <538F83DF.8090303@gatech.edu> (raw)
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
next reply other threads:[~2014-06-04 20:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-04 20:38 Pranith Kumar [this message]
2014-06-04 20:56 ` [RFC PATCH 1/1] remove redundant compare, cmpxchg already does it 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=538F83DF.8090303@gatech.edu \
--to=pranith@gatech.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox