Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1446778
| From | Jason Low <jason.low2@hpe.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC] locking/mutex: Fix starvation of sleeping waiters |
| Date | 2016-07-20 01:10 +0200 |
| Message-ID | <rWMjf-1Q5-1@gated-at.bofh.it> (permalink) |
| References | <rWjqW-8vS-25@gated-at.bofh.it> <rWkn0-FB-23@gated-at.bofh.it> <rWkQ1-PW-1@gated-at.bofh.it> <rWGxc-6sA-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 2016-07-19 at 19:53 +0300, Imre Deak wrote: > On ma, 2016-07-18 at 10:47 -0700, Jason Low wrote: > > On Mon, 2016-07-18 at 19:15 +0200, Peter Zijlstra wrote: > > > I think we went over this before, that will also completely destroy > > > performance under a number of workloads. > > > > Yup, once a thread becomes a waiter, all other threads will need to > > follow suit, so this change would effectively disable optimistic > > spinning in some workloads. > > > > A few months ago, we worked on patches that allow the waiter to > > return > > to optimistic spinning to help reduce starvation. Longman sent out a > > version 3 patch set, and it sounded like we were fine with the > > concept. > > Thanks, with v4 he just sent I couldn't trigger the above problem. > > However this only works if mutex spinning is enabled, if it's disabled > I still hit the problem due to the other forms of lock stealing. So > could we prevent these if mutex spinning is anyway disabled? Good point, when optimistic spinning is disabled, waiters could still get starved because other threads could steal the lock in the fastpath and the waiter wouldn't be able to spin for the lock. One option to address this is by enforcing a ceiling on the amount of "time" a waiter needs to wait on the lock to avoid starvation when optimistic spinning is disabled. This would be better than just unconditionally disabling the fastpath whenever there is a waiter, because that could reduce performance by quite a bit. Instead, we can still allow threads to acquire the lock in the fastpath if there are waiters, but yield the lock to a waiter if the waiter loops too many times waiting for the lock in the slowpath in the !CONFIG_MUTEX_OPTIMISTIC_SPINNING case. I can send out an initial patch for this. Jason
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC] locking/mutex: Fix starvation of sleeping waiters Imre Deak <imre.deak@intel.com> - 2016-07-18 18:20 +0200
Re: [RFC] locking/mutex: Fix starvation of sleeping waiters Peter Zijlstra <peterz@infradead.org> - 2016-07-18 19:20 +0200
Re: [RFC] locking/mutex: Fix starvation of sleeping waiters Jason Low <jason.low2@hpe.com> - 2016-07-18 19:50 +0200
Re: [RFC] locking/mutex: Fix starvation of sleeping waiters Imre Deak <imre.deak@intel.com> - 2016-07-19 19:00 +0200
Re: [RFC] locking/mutex: Fix starvation of sleeping waiters Jason Low <jason.low2@hpe.com> - 2016-07-20 01:10 +0200
[RFC] Avoid mutex starvation when optimistic spinning is disabled Jason Low <jason.low2@hpe.com> - 2016-07-20 01:20 +0200
Re: [RFC] Avoid mutex starvation when optimistic spinning is disabled Jason Low <jason.low2@hpe.com> - 2016-07-20 06:50 +0200
Re: [RFC] Avoid mutex starvation when optimistic spinning is disabled Imre Deak <imre.deak@intel.com> - 2016-07-20 15:40 +0200
Re: [RFC] Avoid mutex starvation when optimistic spinning is disabled Jason Low <jason.low2@hpe.com> - 2016-07-21 23:00 +0200
Re: [RFC] Avoid mutex starvation when optimistic spinning is disabled Davidlohr Bueso <dave@stgolabs.net> - 2016-07-22 20:10 +0200
Re: [RFC] Avoid mutex starvation when optimistic spinning is disabled Imre Deak <imre.deak@intel.com> - 2016-07-22 20:40 +0200
Re: [RFC] Avoid mutex starvation when optimistic spinning is disabled Davidlohr Bueso <dave@stgolabs.net> - 2016-07-22 21:30 +0200
Re: [RFC] Avoid mutex starvation when optimistic spinning is disabled Imre Deak <imre.deak@intel.com> - 2016-07-22 22:00 +0200
Re: [RFC] Avoid mutex starvation when optimistic spinning is disabled Jason Low <jason.low2@hpe.com> - 2016-07-22 00:40 +0200
Re: [RFC] Avoid mutex starvation when optimistic spinning is disabled Imre Deak <imre.deak@intel.com> - 2016-07-22 11:40 +0200
Re: [RFC] Avoid mutex starvation when optimistic spinning is disabled Jason Low <jason.low2@hpe.com> - 2016-07-22 20:50 +0200
csiph-web