lkml.org 
[lkml]   [2021]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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().

\
 
 \ /
  Last update: 2021-06-30 16:52    [W:1.998 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site