login
Header Space

 
 

Re: [patch 1/4] x86: FIFO ticket spinlocks

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linus Torvalds <torvalds@...>
Cc: Gregory Haskins <gregory.haskins@...>, Nick Piggin <npiggin@...>, Linux Kernel Mailing List <linux-kernel@...>, Andi Kleen <ak@...>, Ingo Molnar <mingo@...>
Date: Friday, November 2, 2007 - 10:24 am

Linus Torvalds wrote:

Sure thing.  Ill try this next week.


I see where you are going here, and I mostly agree.  I think the key is
that "given equal contention, let the guy with the hottest cache win".
The problem with the current implementation is that the spinlocks have
no way to gauge the details of the contention.  They can only gauge
instantaneous snapshots of state as viewed by each TSL invocation, which
effectively resets your position each time.

On the flip side, Nick's patches take the opposite extreme.  If a lock
is contended, get in line. ;)  This has the desirable property of
avoiding starvation.  However, it will also tend to cause more bouncing
since you are virtually guaranteed not to re-win the contended lock, as
you point out next.


My issue here is that this behavior can also be described as precisely
part of the problem being addressed:  That is, both CPUs presumably
*want/need* access to the data or they wouldn't be taking the spinlock
to begin with.  So its really not a question of keeping the structures
on one cpu per se (at least, not for unbounded durations or the system
won't operate properly).

Rather, I think the key is to minimize the impact by bouncing things
intelligently. ;)  I.e. If all things are equal, favor the hottest task
so the data only bounces once instead of twice.  Outside of this
condition, operate strict FIFO.  If we can reasonably calculate when
this optimization is possible, we will have the best of both worlds.  I
have some ideas about ways to extend Nicks algorithm to support this
which I will submit ASAP.

I think the rest of what you said is very fair:  Prove that it's a
problem, this concept helps, and we don't make things worse ;)

Will do, ASAP.

Regards,
-Greg

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 0/4] ticket spinlocks for x86, Nick Piggin, (Thu Nov 1, 10:01 am)
Re: [patch 0/4] ticket spinlocks for x86, Jeremy Fitzhardinge, (Sat Nov 3, 6:36 pm)
[patch 4/4] x86: spinlock.h merge, Nick Piggin, (Thu Nov 1, 10:05 am)
[patch 3/4] x86: spinlock.h merge prep, Nick Piggin, (Thu Nov 1, 10:04 am)
[patch 1/4] x86: FIFO ticket spinlocks, Nick Piggin, (Thu Nov 1, 10:03 am)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Chuck Ebbert, (Fri Nov 2, 12:22 pm)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Linus Torvalds, (Fri Nov 2, 12:51 pm)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Nick Piggin, (Fri Nov 2, 7:01 pm)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Chuck Ebbert, (Fri Nov 2, 8:56 pm)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Nick Piggin, (Fri Nov 2, 11:41 pm)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Chuck Ebbert, (Thu Nov 1, 4:01 pm)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Nick Piggin, (Thu Nov 1, 8:00 pm)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Gregory Haskins, (Thu Nov 1, 10:40 am)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Linus Torvalds, (Thu Nov 1, 12:38 pm)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Gregory Haskins, (Fri Nov 2, 10:24 am)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Rik van Riel, (Thu Nov 1, 8:35 pm)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Linus Torvalds, (Thu Nov 1, 9:19 pm)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Nick Piggin, (Fri Nov 2, 2:42 am)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Ingo Molnar, (Fri Nov 2, 11:33 am)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Nick Piggin, (Wed Nov 7, 4:46 am)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Rik van Riel, (Fri Nov 2, 10:05 am)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Nick Piggin, (Fri Nov 2, 6:37 pm)
Re: [patch 1/4] x86: FIFO ticket spinlocks, Rik van Riel, (Thu Nov 1, 10:01 pm)
[patch 1/4] spinlock: lockbreak cleanup, Nick Piggin, (Thu Nov 1, 10:02 am)
Re: [patch 1/4] spinlock: lockbreak cleanup, Peter Zijlstra, (Thu Nov 1, 10:06 am)
Re: [patch 1/4] spinlock: lockbreak cleanup, Nick Piggin, (Thu Nov 1, 10:29 am)
Re: [patch 1/4] spinlock: lockbreak cleanup, Lee Schermerhorn, (Thu Nov 1, 11:39 am)
Re: [patch 1/4] spinlock: lockbreak cleanup, Ingo Molnar, (Thu Nov 1, 11:46 am)
Re: [patch 1/4] spinlock: lockbreak cleanup, Nick Piggin, (Thu Nov 1, 11:53 am)
speck-geostationary