summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/locking/mutex.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index 16b2d3c..4cccea6 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -224,20 +224,14 @@ ww_mutex_set_context_slowpath(struct ww_mutex *lock,
static noinline
bool mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner)
{
- bool ret;
+ bool ret = true;
rcu_read_lock();
- while (true) {
- /* Return success when the lock owner changed */
- if (lock->owner != owner) {
- ret = true;
- break;
- }
-
+ while (lock->owner == owner) {
/*
* Ensure we emit the owner->on_cpu, dereference _after_
- * checking lock->owner still matches owner, if that fails,
- * owner might point to free()d memory, if it still matches,
+ * checking lock->owner still matches owner. If that fails,
+ * owner might point to freed memory. If it still matches,
* the rcu_read_lock() ensures the memory stays valid.
*/
barrier();
OpenPOWER on IntegriCloud