Skip to content

Commit 8f556a3

Browse files
qiangzh3KAGA-KOKO
authored andcommitted
locking/rtmutex: Fix incorrect condition in rtmutex_spin_on_owner()
Optimistic spinning needs to be terminated when the spinning waiter is not longer the top waiter on the lock, but the condition is negated. It terminates if the waiter is the top waiter, which is defeating the whole purpose. Fixes: c3123c4 ("locking/rtmutex: Dont dereference waiter lockless") Signed-off-by: Zqiang <qiang1.zhang@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20211217074207.77425-1-qiang1.zhang@intel.com
1 parent 2585cf9 commit 8f556a3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kernel/locking/rtmutex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,7 @@ static bool rtmutex_spin_on_owner(struct rt_mutex_base *lock,
13801380
* - the VCPU on which owner runs is preempted
13811381
*/
13821382
if (!owner->on_cpu || need_resched() ||
1383-
rt_mutex_waiter_is_top_waiter(lock, waiter) ||
1383+
!rt_mutex_waiter_is_top_waiter(lock, waiter) ||
13841384
vcpu_is_preempted(task_cpu(owner))) {
13851385
res = false;
13861386
break;

0 commit comments

Comments
 (0)