[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <57925E25.8010506@hpe.com>
Date: Fri, 22 Jul 2016 13:55:49 -0400
From: Waiman Long <waiman.long@....com>
To: Jason Low <jason.low2@....com>
CC: <imre.deak@...el.com>, Peter Zijlstra <peterz@...radead.org>,
<linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...hat.com>,
Chris Wilson <chris@...is-wilson.co.uk>,
Daniel Vetter <daniel.vetter@...el.com>,
Davidlohr Bueso <dave@...olabs.net>
Subject: Re: [RFC] Avoid mutex starvation when optimistic spinning is disabled
On 07/21/2016 04:57 PM, Jason Low wrote:
> 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
>> handling
> 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.
>
> Thanks,
> Jason
>
I think making mutex_trylock() fail maybe a bit too far. Do we really
have any real workload that cause starvation problem because of that.
Code that does mutex_trylock() in a loop can certainly cause lock
starvation, but it is not how mutex_trylock() is supposed to be used. We
can't build in safeguard for all the possible abuses of the mutex APIs.
Cheers,
Longman
Powered by blists - more mailing lists