Re: [RFC] Avoid mutex starvation when optimistic spinning is disabled
From: Jason Low
Date: Thu Jul 21 2016 - 16:58:27 EST
On Wed, 2016-07-20 at 16:29 +0300, Imre Deak wrote:
> On ti, 2016-07-19 at 21:39 -0700, Jason Low wrote:
> > On Tue, 2016-07-19 at 16:04 -0700, Jason Low wrote:
> > > Hi Imre,
> > >
> > > Here is a patch which prevents a thread from spending too much "time"
> > > waiting for a mutex in the !CONFIG_MUTEX_SPIN_ON_OWNER case.
> > >
> > > Would you like to try this out and see if this addresses the mutex
> > > starvation issue you are seeing in your workload when optimistic
> > > spinning is disabled?
> > Although it looks like it didn't take care of the 'lock stealing' case
> > in the slowpath. Here is the updated fixed version:
> This also got rid of the problem, I only needed to change the ww
> functions accordingly. Also, imo mutex_trylock() needs the same
Good point. I supposed mutex_trylock() may not be causing starvation
issues, but I agree that it makes sense if mutex_trylock() fails too if
threads are supposed to yield to a waiter. I'll make the update.