[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1406608312.31161.6.camel@buesod1.americas.hpqcorp.net>
Date: Mon, 28 Jul 2014 21:31:52 -0700
From: Davidlohr Bueso <davidlohr@...com>
To: Jason Low <jason.low2@...com>
Cc: peterz@...radead.org, mingo@...nel.org, aswin@...com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH -tip/master v2] locking/mutex: Refactor optimistic
spinning code
On Mon, 2014-07-28 at 20:41 -0700, Jason Low wrote:
> On Mon, 2014-07-28 at 19:55 -0700, Davidlohr Bueso wrote:
> > +static bool mutex_optimistic_spin(struct mutex *lock,
> > + struct ww_acquire_ctx *ww_ctx, const bool use_ww_ctx)
> > +{
> > + struct task_struct *task = current;
> > +
> > + if (!mutex_can_spin_on_owner(lock))
> > + return false;
> > +
> > + if (!osq_lock(&lock->osq))
> > + return false;
>
> In the !osq_lock() case, we could exit the cancellable MCS spinlock due
> to need_resched(). However, this would return from the function rather
> than doing the need_resched() check below. Perhaps we can add something
> like "goto out" which goes to the below check?
Ah, yes. This used to be a goto slowpath. It would have served the other
way around, if having the need_resched() check outside of
mutex_optimistic_spin().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists