From: Waiman Long <waiman.long@hpe.com>
To: Jason Low <jason.low2@hpe.com>
Cc: <imre.deak@intel.com>, Peter Zijlstra <peterz@infradead.org>,
<linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@redhat.com>,
Chris Wilson <chris@chris-wilson.co.uk>,
Daniel Vetter <daniel.vetter@intel.com>,
Davidlohr Bueso <dave@stgolabs.net>
Subject: Re: [RFC] Avoid mutex starvation when optimistic spinning is disabled
Date: Fri, 22 Jul 2016 13:55:49 -0400 [thread overview]
Message-ID: <57925E25.8010506@hpe.com> (raw)
In-Reply-To: <1469134658.2344.12.camel@j-VirtualBox>
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
next prev parent reply other threads:[~2016-07-22 17:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-18 16:16 [RFC] locking/mutex: Fix starvation of sleeping waiters Imre Deak
2016-07-18 17:15 ` Peter Zijlstra
2016-07-18 17:47 ` Jason Low
2016-07-19 16:53 ` Imre Deak
2016-07-19 22:57 ` Jason Low
2016-07-19 23:04 ` [RFC] Avoid mutex starvation when optimistic spinning is disabled Jason Low
2016-07-20 4:39 ` Jason Low
2016-07-20 13:29 ` Imre Deak
2016-07-21 20:57 ` Jason Low
2016-07-22 17:55 ` Waiman Long [this message]
2016-07-22 18:03 ` Davidlohr Bueso
2016-07-22 18:29 ` Imre Deak
2016-07-22 19:26 ` Davidlohr Bueso
2016-07-22 19:53 ` Imre Deak
2016-07-20 18:37 ` Waiman Long
2016-07-21 22:29 ` Jason Low
2016-07-22 9:34 ` Imre Deak
2016-07-22 18:44 ` Jason Low
2016-07-22 18:01 ` Waiman Long
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57925E25.8010506@hpe.com \
--to=waiman.long@hpe.com \
--cc=chris@chris-wilson.co.uk \
--cc=daniel.vetter@intel.com \
--cc=dave@stgolabs.net \
--cc=imre.deak@intel.com \
--cc=jason.low2@hpe.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).