Lines Matching full:owner

48 	atomic_long_set(&lock->owner, 0);  in __mutex_init()
59 static inline struct task_struct *__owner_task(unsigned long owner) in __owner_task() argument
61 return (struct task_struct *)(owner & ~MUTEX_FLAGS); in __owner_task()
70 static inline unsigned long __owner_flags(unsigned long owner) in __owner_flags() argument
72 return owner & MUTEX_FLAGS; in __owner_flags()
80 unsigned long owner, curr = (unsigned long)current; in __mutex_trylock_common() local
82 owner = atomic_long_read(&lock->owner); in __mutex_trylock_common()
84 unsigned long flags = __owner_flags(owner); in __mutex_trylock_common()
85 unsigned long task = owner & ~MUTEX_FLAGS; in __mutex_trylock_common()
104 if (atomic_long_try_cmpxchg_acquire(&lock->owner, &owner, task | flags)) { in __mutex_trylock_common()
111 return __owner_task(owner); in __mutex_trylock_common()
146 if (atomic_long_try_cmpxchg_acquire(&lock->owner, &zero, curr)) in __mutex_trylock_fast()
156 return atomic_long_try_cmpxchg_release(&lock->owner, &curr, 0UL); in __mutex_unlock_fast()
162 atomic_long_or(flag, &lock->owner); in __mutex_set_flag()
167 atomic_long_andnot(flag, &lock->owner); in __mutex_clear_flag()
208 unsigned long owner = atomic_long_read(&lock->owner); in __mutex_handoff() local
213 MUTEX_WARN_ON(__owner_task(owner) != current); in __mutex_handoff()
214 MUTEX_WARN_ON(owner & MUTEX_FLAG_PICKUP); in __mutex_handoff()
216 new = (owner & MUTEX_FLAG_WAITERS); in __mutex_handoff()
221 if (atomic_long_try_cmpxchg_release(&lock->owner, &owner, new)) in __mutex_handoff()
307 if (!waiter && (atomic_long_read(&lock->owner) & MUTEX_FLAG_WAITERS)) in ww_mutex_spin_on_owner()
321 * Look out! "owner" is an entirely speculative pointer access and not
327 bool mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner, in mutex_spin_on_owner() argument
334 while (__mutex_owner(lock) == owner) { in mutex_spin_on_owner()
336 * Ensure we emit the owner->on_cpu, dereference _after_ in mutex_spin_on_owner()
337 * checking lock->owner still matches owner. And we already in mutex_spin_on_owner()
348 if (!owner_on_cpu(owner) || need_resched()) { in mutex_spin_on_owner()
369 struct task_struct *owner; in mutex_can_spin_on_owner() local
382 owner = __mutex_owner(lock); in mutex_can_spin_on_owner()
383 if (owner) in mutex_can_spin_on_owner()
384 retval = owner_on_cpu(owner); in mutex_can_spin_on_owner()
387 * If lock->owner is not set, the mutex has been released. Return true in mutex_can_spin_on_owner()
397 * We try to spin for acquisition when we find that the lock owner
399 * need to reschedule. The rationale is that if the lock owner is
412 * with the spinner at the head of the OSQ, if present, until the owner is
433 * MCS (queued) lock first before spinning on the owner field. in mutex_optimistic_spin()
440 struct task_struct *owner; in mutex_optimistic_spin() local
443 owner = __mutex_trylock_or_owner(lock); in mutex_optimistic_spin()
444 if (!owner) in mutex_optimistic_spin()
448 * There's an owner, wait for it to either in mutex_optimistic_spin()
451 if (!mutex_spin_on_owner(lock, owner, ww_ctx, waiter)) in mutex_optimistic_spin()
573 * race and wound us here since they can't have a valid owner in __mutex_lock_common()
762 * race and wound us here, since they can't have a valid owner in ww_mutex_trylock()
888 unsigned long owner; in __mutex_unlock_slowpath() local
897 * Except when HANDOFF, in that case we must not clear the owner field, in __mutex_unlock_slowpath()
900 owner = atomic_long_read(&lock->owner); in __mutex_unlock_slowpath()
902 MUTEX_WARN_ON(__owner_task(owner) != current); in __mutex_unlock_slowpath()
903 MUTEX_WARN_ON(owner & MUTEX_FLAG_PICKUP); in __mutex_unlock_slowpath()
905 if (owner & MUTEX_FLAG_HANDOFF) in __mutex_unlock_slowpath()
908 if (atomic_long_try_cmpxchg_release(&lock->owner, &owner, __owner_flags(owner))) { in __mutex_unlock_slowpath()
909 if (owner & MUTEX_FLAG_WAITERS) in __mutex_unlock_slowpath()
930 if (owner & MUTEX_FLAG_HANDOFF) in __mutex_unlock_slowpath()