We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8ca3eb0 + 9d0f4dc commit 3b6c550Copy full SHA for 3b6c550
kernel/sched.c
@@ -3865,8 +3865,16 @@ int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner)
3865
/*
3866
* Owner changed, break to re-assess state.
3867
*/
3868
- if (lock->owner != owner)
+ if (lock->owner != owner) {
3869
+ /*
3870
+ * If the lock has switched to a different owner,
3871
+ * we likely have heavy contention. Return 0 to quit
3872
+ * optimistic spinning and not contend further:
3873
+ */
3874
+ if (lock->owner)
3875
+ return 0;
3876
break;
3877
+ }
3878
3879
3880
* Is that owner really running on that cpu?
0 commit comments