kernel/futex: Move hb unlock out of unqueue_me_pi()
This improves the code readability, and the locking more obvious as it becomes symmetric for the caller. Signed-off-by: Davidlohr Bueso <dbueso@suse.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20210226175029.50335-3-dave@stgolabs.net
This commit is contained in:
parent
a1565aa469
commit
a3f2428d2b
|
@ -2318,19 +2318,15 @@ retry:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PI futexes can not be requeued and must remove themself from the
|
* PI futexes can not be requeued and must remove themself from the
|
||||||
* hash bucket. The hash bucket lock (i.e. lock_ptr) is held on entry
|
* hash bucket. The hash bucket lock (i.e. lock_ptr) is held.
|
||||||
* and dropped here.
|
|
||||||
*/
|
*/
|
||||||
static void unqueue_me_pi(struct futex_q *q)
|
static void unqueue_me_pi(struct futex_q *q)
|
||||||
__releases(q->lock_ptr)
|
|
||||||
{
|
{
|
||||||
__unqueue_futex(q);
|
__unqueue_futex(q);
|
||||||
|
|
||||||
BUG_ON(!q->pi_state);
|
BUG_ON(!q->pi_state);
|
||||||
put_pi_state(q->pi_state);
|
put_pi_state(q->pi_state);
|
||||||
q->pi_state = NULL;
|
q->pi_state = NULL;
|
||||||
|
|
||||||
spin_unlock(q->lock_ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
|
static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
|
||||||
|
@ -2913,8 +2909,8 @@ no_block:
|
||||||
if (res)
|
if (res)
|
||||||
ret = (res < 0) ? res : 0;
|
ret = (res < 0) ? res : 0;
|
||||||
|
|
||||||
/* Unqueue and drop the lock */
|
|
||||||
unqueue_me_pi(&q);
|
unqueue_me_pi(&q);
|
||||||
|
spin_unlock(q.lock_ptr);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
out_unlock_put_key:
|
out_unlock_put_key:
|
||||||
|
@ -3290,8 +3286,8 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
|
||||||
if (res)
|
if (res)
|
||||||
ret = (res < 0) ? res : 0;
|
ret = (res < 0) ? res : 0;
|
||||||
|
|
||||||
/* Unqueue and drop the lock. */
|
|
||||||
unqueue_me_pi(&q);
|
unqueue_me_pi(&q);
|
||||||
|
spin_unlock(q.lock_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == -EINTR) {
|
if (ret == -EINTR) {
|
||||||
|
|
Loading…
Reference in New Issue