linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] locking/rtmutex: Fix incorrect spinning condition
@ 2021-12-17  7:42 Zqiang
  2021-12-17 20:53 ` Thomas Gleixner
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Zqiang @ 2021-12-17  7:42 UTC (permalink / raw)
  To: peterz, mingo, will, longman; +Cc: linux-kernel, qiang1.zhang

When the lock owner is on CPU and not need resched, the current waiter
need to be checked, if it not longer top the waiter, stop spinning.

Fixes: c3123c431447 ("locking/rtmutex: Dont dereference waiter lockless")
Signed-off-by: Zqiang <qiang1.zhang@intel.com>
---
 v1->v2:
 Modify description information.

 kernel/locking/rtmutex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index 0c1f2e3f019a..8555c4efe97c 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1383,7 +1383,7 @@ static bool rtmutex_spin_on_owner(struct rt_mutex_base *lock,
 		 *  - the VCPU on which owner runs is preempted
 		 */
 		if (!owner_on_cpu(owner) || need_resched() ||
-		    rt_mutex_waiter_is_top_waiter(lock, waiter)) {
+		    !rt_mutex_waiter_is_top_waiter(lock, waiter)) {
 			res = false;
 			break;
 		}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-12-20  1:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17  7:42 [PATCH v2] locking/rtmutex: Fix incorrect spinning condition Zqiang
2021-12-17 20:53 ` Thomas Gleixner
2021-12-18  7:24   ` Zhang, Qiang1
2021-12-18  9:34     ` Thomas Gleixner
2021-12-20  1:45       ` Zhang, Qiang1
2021-12-18 10:01 ` [tip: locking/core] locking/rtmutex: Fix incorrect condition in rtmutex_spin_on_owner() tip-bot2 for Zqiang
2021-12-19 21:09 ` [PATCH v2] locking/rtmutex: Fix incorrect spinning condition Waiman Long
2021-12-20  1:54   ` Zhang, Qiang1

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).