aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/locking
diff options
context:
space:
mode:
authorWaiman Long <longman@redhat.com>2017-01-21 21:33:35 -0500
committerIngo Molnar <mingo@kernel.org>2017-01-22 03:54:00 -0500
commitbcc9a76d5ac426bc45c9e863b1830347827ca77a (patch)
tree9071148e7e216738ff5b9b0896019415425d42ee /kernel/locking
parent06321dd2d1ae5b5bdc847958ab9e71d22a29a33e (diff)
locking/rwsem: Reinit wake_q after use
In __rwsem_down_write_failed_common(), the same wake_q variable name is defined twice, with the inner wake_q hiding the one in outer scope. We can either use different names for the two wake_q's. Even better, we can use the same wake_q twice, if necessary. To enable the latter change, we need to define a new helper function wake_q_init() to enable reinitalization of wake_q after use. Signed-off-by: Waiman Long <longman@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1485052415-9611-1-git-send-email-longman@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/locking')
-rw-r--r--kernel/locking/rwsem-xadd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c
index a3a381aee24b..2ad8d8dc3bb1 100644
--- a/kernel/locking/rwsem-xadd.c
+++ b/kernel/locking/rwsem-xadd.c
@@ -502,8 +502,6 @@ __rwsem_down_write_failed_common(struct rw_semaphore *sem, int state)
502 * wake any read locks that were queued ahead of us. 502 * wake any read locks that were queued ahead of us.
503 */ 503 */
504 if (count > RWSEM_WAITING_BIAS) { 504 if (count > RWSEM_WAITING_BIAS) {
505 DEFINE_WAKE_Q(wake_q);
506
507 __rwsem_mark_wake(sem, RWSEM_WAKE_READERS, &wake_q); 505 __rwsem_mark_wake(sem, RWSEM_WAKE_READERS, &wake_q);
508 /* 506 /*
509 * The wakeup is normally called _after_ the wait_lock 507 * The wakeup is normally called _after_ the wait_lock
@@ -513,6 +511,11 @@ __rwsem_down_write_failed_common(struct rw_semaphore *sem, int state)
513 * for attempting rwsem_try_write_lock(). 511 * for attempting rwsem_try_write_lock().
514 */ 512 */
515 wake_up_q(&wake_q); 513 wake_up_q(&wake_q);
514
515 /*
516 * Reinitialize wake_q after use.
517 */
518 wake_q_init(&wake_q);
516 } 519 }
517 520
518 } else 521 } else