diff options
-rw-r--r-- | kernel/mutex.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/mutex.c b/kernel/mutex.c index ff05f4bd86eb..7ff48c55a98b 100644 --- a/kernel/mutex.c +++ b/kernel/mutex.c | |||
@@ -209,11 +209,13 @@ int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner) | |||
209 | */ | 209 | */ |
210 | static inline int mutex_can_spin_on_owner(struct mutex *lock) | 210 | static inline int mutex_can_spin_on_owner(struct mutex *lock) |
211 | { | 211 | { |
212 | struct task_struct *owner; | ||
212 | int retval = 1; | 213 | int retval = 1; |
213 | 214 | ||
214 | rcu_read_lock(); | 215 | rcu_read_lock(); |
215 | if (lock->owner) | 216 | owner = ACCESS_ONCE(lock->owner); |
216 | retval = lock->owner->on_cpu; | 217 | if (owner) |
218 | retval = owner->on_cpu; | ||
217 | rcu_read_unlock(); | 219 | rcu_read_unlock(); |
218 | /* | 220 | /* |
219 | * if lock->owner is not set, the mutex owner may have just acquired | 221 | * if lock->owner is not set, the mutex owner may have just acquired |