Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-23 Thread Peter Zijlstra
On Wed, Jul 23, 2014 at 09:39:03AM +0200, Mike Galbraith wrote: > On Wed, 2014-07-23 at 09:35 +0200, Peter Zijlstra wrote: > > On Wed, Jul 23, 2014 at 09:25:46AM +0200, Mike Galbraith wrote: > > > I also resurrect mwait_idle(), as while you may consider it obsolete, I > > > still love my lovely li

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-23 Thread Mike Galbraith
On Wed, 2014-07-23 at 09:35 +0200, Peter Zijlstra wrote: > On Wed, Jul 23, 2014 at 09:25:46AM +0200, Mike Galbraith wrote: > > I also resurrect mwait_idle(), as while you may consider it obsolete, I > > still love my lovely little Q6600 box (power sucking pig) dearly :) > > Yeah, I keep forgettin

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-23 Thread Peter Zijlstra
On Wed, Jul 23, 2014 at 09:25:46AM +0200, Mike Galbraith wrote: > I also resurrect mwait_idle(), as while you may consider it obsolete, I > still love my lovely little Q6600 box (power sucking pig) dearly :) Yeah, I keep forgetting about that one.. we should get that fixed. -- To unsubscribe from

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-23 Thread Mike Galbraith
On Wed, 2014-07-23 at 08:57 +0200, Peter Zijlstra wrote: > On Wed, Jul 23, 2014 at 06:55:03AM +0200, Mike Galbraith wrote: > > On Mon, 2014-07-21 at 09:42 -0700, Andi Kleen wrote: > > > > > FWIW the main problem is currently that switch-through-idle is so > > > slow. I think improving that would

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-22 Thread Peter Zijlstra
On Wed, Jul 23, 2014 at 06:55:03AM +0200, Mike Galbraith wrote: > On Mon, 2014-07-21 at 09:42 -0700, Andi Kleen wrote: > > > FWIW the main problem is currently that switch-through-idle is so > > slow. I think improving that would give a boost to far more > > situations. > > Two high frequency id

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-22 Thread Mike Galbraith
On Mon, 2014-07-21 at 09:42 -0700, Andi Kleen wrote: > FWIW the main problem is currently that switch-through-idle is so > slow. I think improving that would give a boost to far more > situations. Two high frequency idle enter/exit suckage spots: 1) nohz (tick) - it's expensive to start/stop ti

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-22 Thread Thomas Gleixner
On Tue, 22 Jul 2014, Waiman Long wrote: > On 07/21/2014 09:01 PM, Thomas Gleixner wrote: > > So before anyone comes up with a "solution" for all of this tomorrow > > afternoon in form of another half baken patch, please sit back mull it > > in your head and lets have a proper discussion about the a

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-22 Thread Thomas Gleixner
On Tue, 22 Jul 2014, Waiman Long wrote: > On 07/22/2014 05:59 AM, Thomas Gleixner wrote: > > On Tue, 22 Jul 2014, Peter Zijlstra wrote: > > > On Tue, Jul 22, 2014 at 10:39:17AM +0200, Thomas Gleixner wrote: > > > > On Tue, 22 Jul 2014, Peter Zijlstra wrote: > > > > > Anyway, there is one big fail

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-22 Thread Waiman Long
On 07/22/2014 05:59 AM, Thomas Gleixner wrote: On Tue, 22 Jul 2014, Peter Zijlstra wrote: On Tue, Jul 22, 2014 at 10:39:17AM +0200, Thomas Gleixner wrote: On Tue, 22 Jul 2014, Peter Zijlstra wrote: Anyway, there is one big fail in the entire futex stack that we 'need' to sort some day and that

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-22 Thread Waiman Long
On 07/21/2014 09:01 PM, Thomas Gleixner wrote: On Mon, 21 Jul 2014, Darren Hart wrote: On 7/21/14, 14:47, "Thomas Gleixner" wrote: On Mon, 21 Jul 2014, Andy Lutomirski wrote: On Mon, Jul 21, 2014 at 2:27 PM, Peter Zijlstra wrote: All this is predicated on the fact that syscalls are 'expensi

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-22 Thread Waiman Long
On 07/21/2014 05:18 PM, Ingo Molnar wrote: * Waiman Long wrote: Testing done on a 4-socket Westmere-EX boxes with 40 cores (HT off) showed the following performance data (average kops/s) with various load factor (number of pause instructions) used in the critical section using an userspace mut

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-22 Thread Waiman Long
On 07/21/2014 12:45 PM, Andi Kleen wrote: Andi Kleen writes: Waiman Long writes: This patch series introduces two new futex command codes to support a new optimistic spinning futex for implementing an exclusive lock primitive that should perform better than the same primitive using the wait

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-22 Thread Waiman Long
On 07/21/2014 12:42 PM, Andi Kleen wrote: Waiman Long writes: This patch series introduces two new futex command codes to support a new optimistic spinning futex for implementing an exclusive lock primitive that should perform better than the same primitive using the wait-wake futex in cases w

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-22 Thread Thomas Gleixner
On Tue, 22 Jul 2014, Peter Zijlstra wrote: > On Tue, Jul 22, 2014 at 10:39:17AM +0200, Thomas Gleixner wrote: > > On Tue, 22 Jul 2014, Peter Zijlstra wrote: > > > Anyway, there is one big fail in the entire futex stack that we 'need' > > > to sort some day and that is NUMA. Some people (again datab

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-22 Thread Peter Zijlstra
On Tue, Jul 22, 2014 at 10:39:17AM +0200, Thomas Gleixner wrote: > On Tue, 22 Jul 2014, Peter Zijlstra wrote: > > Anyway, there is one big fail in the entire futex stack that we 'need' > > to sort some day and that is NUMA. Some people (again database people) > > explicitly do not use futexes and i

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-22 Thread Thomas Gleixner
On Tue, 22 Jul 2014, Peter Zijlstra wrote: > Anyway, there is one big fail in the entire futex stack that we 'need' > to sort some day and that is NUMA. Some people (again database people) > explicitly do not use futexes and instead use sysvsem because of this. > > The problem with numa futexes is

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-22 Thread Peter Zijlstra
On Mon, Jul 21, 2014 at 09:34:57PM -0400, Steven Rostedt wrote: > I just want to point out that I was having a very nice conversation > with Robert Haas (Cc'd) in Napa Valley at Linux Collaboration about > this very topic. Robert is a PostgeSQL developer who told me that they > implement their spi

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-22 Thread Peter Zijlstra
On Mon, Jul 21, 2014 at 05:32:55PM -0700, Davidlohr Bueso wrote: > On Mon, 2014-07-21 at 14:31 -0700, Andy Lutomirski wrote: > > On Mon, Jul 21, 2014 at 2:27 PM, Peter Zijlstra > > wrote: > > > All this is predicated on the fact that syscalls are 'expensive'. > > > Weren't syscalls only 100s of c

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Davidlohr Bueso
On Mon, 2014-07-21 at 21:34 -0400, Steven Rostedt wrote: > On Tue, 22 Jul 2014 03:01:00 +0200 (CEST) > Thomas Gleixner wrote: > > > On Mon, 21 Jul 2014, Darren Hart wrote: > > > On 7/21/14, 14:47, "Thomas Gleixner" wrote: > > > > > > >On Mon, 21 Jul 2014, Andy Lutomirski wrote: > > > >> On Mon,

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Mike Galbraith
On Mon, 2014-07-21 at 21:34 -0400, Steven Rostedt wrote: > I was telling Robert that if futexes get optimistic spinning, he should > reconsider their use of userspace spinlocks in favor of this, because > I'm pretty sure that they will see a great improvement. My (dated) experience with pgsql say

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Steven Rostedt
On Tue, 22 Jul 2014 03:01:00 +0200 (CEST) Thomas Gleixner wrote: > On Mon, 21 Jul 2014, Darren Hart wrote: > > On 7/21/14, 14:47, "Thomas Gleixner" wrote: > > > > >On Mon, 21 Jul 2014, Andy Lutomirski wrote: > > >> On Mon, Jul 21, 2014 at 2:27 PM, Peter Zijlstra > > >>wrote: > > >> > All this

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Thomas Gleixner
On Mon, 21 Jul 2014, Darren Hart wrote: > On 7/21/14, 14:47, "Thomas Gleixner" wrote: > > >On Mon, 21 Jul 2014, Andy Lutomirski wrote: > >> On Mon, Jul 21, 2014 at 2:27 PM, Peter Zijlstra > >>wrote: > >> > All this is predicated on the fact that syscalls are 'expensive'. > >> > Weren't syscalls

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Davidlohr Bueso
On Mon, 2014-07-21 at 14:31 -0700, Andy Lutomirski wrote: > On Mon, Jul 21, 2014 at 2:27 PM, Peter Zijlstra wrote: > > All this is predicated on the fact that syscalls are 'expensive'. > > Weren't syscalls only 100s of cycles? All this bitmap mucking is far > > more expensive due to cacheline miss

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Darren Hart
On 7/21/14, 14:47, "Thomas Gleixner" wrote: >On Mon, 21 Jul 2014, Andy Lutomirski wrote: >> On Mon, Jul 21, 2014 at 2:27 PM, Peter Zijlstra >>wrote: >> > All this is predicated on the fact that syscalls are 'expensive'. >> > Weren't syscalls only 100s of cycles? All this bitmap mucking is far >>

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Thomas Gleixner
On Mon, 21 Jul 2014, Andy Lutomirski wrote: > On Mon, Jul 21, 2014 at 2:27 PM, Peter Zijlstra wrote: > > All this is predicated on the fact that syscalls are 'expensive'. > > Weren't syscalls only 100s of cycles? All this bitmap mucking is far > > more expensive due to cacheline misses, which due

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Thomas Gleixner
On Mon, 21 Jul 2014, Peter Zijlstra wrote: > On Mon, Jul 21, 2014 at 10:16:37PM +0200, Thomas Gleixner wrote: > > On Mon, 21 Jul 2014, Darren Hart wrote: > > > We observed some significant improvements under some very specific use > > > cases, but a more thorough dive into performance impact in

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Thomas Gleixner
On Mon, 21 Jul 2014, Ingo Molnar wrote: > * Waiman Long wrote: > > > Testing done on a 4-socket Westmere-EX boxes with 40 cores (HT off) > > showed the following performance data (average kops/s) with various > > load factor (number of pause instructions) used in the critical > > section using

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Andy Lutomirski
On Mon, Jul 21, 2014 at 2:27 PM, Peter Zijlstra wrote: > On Mon, Jul 21, 2014 at 10:16:37PM +0200, Thomas Gleixner wrote: >> On Mon, 21 Jul 2014, Darren Hart wrote: >> > We observed some significant improvements under some very specific use >> > cases, but a more thorough dive into performance imp

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Peter Zijlstra
On Mon, Jul 21, 2014 at 10:16:37PM +0200, Thomas Gleixner wrote: > On Mon, 21 Jul 2014, Darren Hart wrote: > > We observed some significant improvements under some very specific use > > cases, but a more thorough dive into performance impact in the other cases > > as well as security implications w

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Ingo Molnar
* Waiman Long wrote: > Testing done on a 4-socket Westmere-EX boxes with 40 cores (HT off) > showed the following performance data (average kops/s) with various > load factor (number of pause instructions) used in the critical > section using an userspace mutex microbenchmark. > > Threads

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Thomas Gleixner
On Mon, 21 Jul 2014, Darren Hart wrote: > We observed some significant improvements under some very specific use > cases, but a more thorough dive into performance impact in the other cases > as well as security implications with the vdso is still wanting. The security implication is that the feat

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Thomas Gleixner
On Mon, 21 Jul 2014, Andi Kleen wrote: > Andi Kleen writes: > > > Waiman Long writes: > > > >> This patch series introduces two new futex command codes to support > >> a new optimistic spinning futex for implementing an exclusive lock > >> primitive that should perform better than the same prim

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Darren Hart
On 7/21/14, 10:20, "Darren Hart" wrote: >On 7/21/14, 9:45, "Andi Kleen" wrote: > >>Andi Kleen writes: >> >>> Waiman Long writes: >>> This patch series introduces two new futex command codes to support a new optimistic spinning futex for implementing an exclusive lock primitive t

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Darren Hart
On 7/21/14, 9:45, "Andi Kleen" wrote: >Andi Kleen writes: > >> Waiman Long writes: >> >>> This patch series introduces two new futex command codes to support >>> a new optimistic spinning futex for implementing an exclusive lock >>> primitive that should perform better than the same primitive u

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Andi Kleen
Andi Kleen writes: > Waiman Long writes: > >> This patch series introduces two new futex command codes to support >> a new optimistic spinning futex for implementing an exclusive lock >> primitive that should perform better than the same primitive using >> the wait-wake futex in cases where the

Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

2014-07-21 Thread Andi Kleen
Waiman Long writes: > This patch series introduces two new futex command codes to support > a new optimistic spinning futex for implementing an exclusive lock > primitive that should perform better than the same primitive using > the wait-wake futex in cases where the lock owner is actively worki