Messages in this thread | | | Date | Wed, 30 Jun 2021 16:50:15 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH] locking/mutex: Reduce chance of setting HANDOFF bit on unlocked mutex |
| |
On Wed, Jun 30, 2021 at 10:43:37PM +0800, Xu, Yanfei wrote: > > +static inline struct task_struct *__mutex_trylock_or_owner(struct mutex *lock, bool handoff) > > { > > unsigned long owner, curr = (unsigned long)current; > > > > owner = atomic_long_read(&lock->owner); > > for (;;) { /* must loop, can race against a flag */ > > + unsigned long flags = __owner_flags(owner); > > unsigned long task = owner & ~MUTEX_FLAGS; > > > > if (task) { > > + if (flags & MUTEX_FLAG_PICKUP) { > > > > + if (task != curr) > > + break; > > + > > + flags &= ~MUTEX_FLAG_PICKUP; > > + > > Hmm.. Should we also clear HANDOFF bit here? I don't find where it is > cleared.
Should already be gone; see __mutex_handoff().
| |