Re: [RFC PATCH 3/3] x86,smp: auto tune spinlock backoff delay factor

2012-12-23 Thread Rafael Aquini
On Fri, Dec 21, 2012 at 10:58:48PM -0500, Rik van Riel wrote: > On 12/21/2012 10:49 PM, Steven Rostedt wrote: > >On Fri, Dec 21, 2012 at 09:51:35PM -0500, Rik van Riel wrote: > > >>However, since spinlock contention should not be the > >>usual state, and all a scalable lock does is make sure > >>t

Re: [RFC PATCH 3/3] x86,smp: auto tune spinlock backoff delay factor

2012-12-22 Thread Rik van Riel
On 12/22/2012 12:42 AM, Michel Lespinasse wrote: However, I have a few concerns about the behavior of this, which I think deserve more experimentation (I may try helping with it after new years). More experimentation is always good. Different hardware will probably behave differently, etc...

Re: [RFC PATCH 3/3] x86,smp: auto tune spinlock backoff delay factor

2012-12-21 Thread Michel Lespinasse
On Fri, Dec 21, 2012 at 3:51 PM, Rik van Riel wrote: > Subject: x86,smp: auto tune spinlock backoff delay factor > > Many spinlocks are embedded in data structures; having many CPUs > pounce on the cache line the lock is in will slow down the lock > holder, and can cause system performance to fall

Re: [RFC PATCH 3/3] x86,smp: auto tune spinlock backoff delay factor

2012-12-21 Thread Rik van Riel
On 12/21/2012 10:49 PM, Steven Rostedt wrote: On Fri, Dec 21, 2012 at 09:51:35PM -0500, Rik van Riel wrote: However, since spinlock contention should not be the usual state, and all a scalable lock does is make sure that N+1 CPUs does not perform worse than N CPUs, using scalable locks is a st

Re: [RFC PATCH 3/3] x86,smp: auto tune spinlock backoff delay factor

2012-12-21 Thread Steven Rostedt
On Fri, Dec 21, 2012 at 09:51:35PM -0500, Rik van Riel wrote: > On 12/21/2012 07:47 PM, David Daney wrote: > > >>+#define MIN_SPINLOCK_DELAY 1 > >>+#define MAX_SPINLOCK_DELAY 1000 > >>+DEFINE_PER_CPU(int, spinlock_delay) = { MIN_SPINLOCK_DELAY }; > > > > > >This gives the same delay for all locks

Re: [RFC PATCH 3/3] x86,smp: auto tune spinlock backoff delay factor

2012-12-21 Thread Rik van Riel
On 12/21/2012 07:47 PM, David Daney wrote: +#define MIN_SPINLOCK_DELAY 1 +#define MAX_SPINLOCK_DELAY 1000 +DEFINE_PER_CPU(int, spinlock_delay) = { MIN_SPINLOCK_DELAY }; This gives the same delay for all locks in the system, but the amount of work done under each lock is different. So, for an

Re: [RFC PATCH 3/3] x86,smp: auto tune spinlock backoff delay factor

2012-12-21 Thread David Daney
On 12/21/2012 03:51 PM, Rik van Riel wrote: Subject: x86,smp: auto tune spinlock backoff delay factor Nice work, A couple of comments... Many spinlocks are embedded in data structures; having many CPUs pounce on the cache line the lock is in will slow down the lock holder, and can cause sys

[RFC PATCH 3/3] x86,smp: auto tune spinlock backoff delay factor

2012-12-21 Thread Rik van Riel
Subject: x86,smp: auto tune spinlock backoff delay factor Many spinlocks are embedded in data structures; having many CPUs pounce on the cache line the lock is in will slow down the lock holder, and can cause system performance to fall off a cliff. The paper "Non-scalable locks are dangerous" is