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


Groups > linux.kernel > #1616680

Re: [tip:locking/core] rtmutex: Deboost before waking up the top waiter

From Mike Galbraith <efault@gmx.de>
Newsgroups linux.kernel
Subject Re: [tip:locking/core] rtmutex: Deboost before waking up the top waiter
Date 2017-04-05 10:20 +0200
Message-ID <tsOky-8y-19@gated-at.bofh.it> (permalink)
References <tocxb-3SR-9@gated-at.bofh.it> <tstpL-39f-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


locking/rtmutex: Fix preempt leak in __rt_mutex_futex_unlock()

mark_wakeup_next_waiter() already disables preemption, doing so
again leaves us with an unpaired preempt_disable().

Signed-off-by: Mike Galbraith <efault@gmx.de>
---
 kernel/locking/rtmutex.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1581,13 +1581,13 @@ bool __sched __rt_mutex_futex_unlock(str
 		return false; /* done */
 	}
 
-	mark_wakeup_next_waiter(wake_q, lock);
 	/*
-	 * We've already deboosted, retain preempt_disabled when dropping
-	 * the wait_lock to avoid inversion until the wakeup. Matched
-	 * by rt_mutex_postunlock();
+	 * We've already deboosted, mark_wakeup_next_waiter() will
+	 * retain preempt_disabled when we drop the wait_lock, to
+	 * avoid inversion prior to the wakeup.  preempt_disable()
+	 * therein pairs with rt_mutex_postunlock().
 	 */
-	preempt_disable();
+	mark_wakeup_next_waiter(wake_q, lock);
 
 	return true; /* call postunlock() */
 }

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


Thread

[tip:locking/core] rtmutex: Deboost before waking up the top waiter tip-bot for Xunlei Pang <tipbot@zytor.com> - 2017-04-04 12:00 +0200
  Re: [tip:locking/core] rtmutex: Deboost before waking up the top  waiter Mike Galbraith <efault@gmx.de> - 2017-04-05 10:20 +0200
    [tip:locking/core]  Retiplockingcore_rtmutex_Deboost_before_waking_up_the_top_waiter tip-bot for Mike Galbraith <tipbot@zytor.com> - 2017-04-05 17:00 +0200
    [tip:locking/core] rtmutex: Plug preempt count leak in  rt_mutex_futex_unlock() tip-bot for Mike Galbraith <tipbot@zytor.com> - 2017-04-05 17:10 +0200
    Re: [tip:locking/core] rtmutex: Deboost before waking up the top  waiter Xunlei Pang <xpang@redhat.com> - 2017-04-06 08:20 +0200

csiph-web