lkml.org 
[lkml]   [2007]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [rfc][patch 2/2] x86_64: FIFO ticket spinlocks
On Mon, Jul 16, 2007 at 11:49:40AM +0200, Ingo Molnar wrote:
>
> * Nick Piggin <npiggin@suse.de> wrote:
>
> > On Mon, Jul 16, 2007 at 11:26:46AM +0200, Ingo Molnar wrote:
> > >
> > > * Nick Piggin <npiggin@suse.de> wrote:
> > >
> > > > [...] trylock is more significantly slower, but they are relatively
> > > > rare.
> > >
> > > trylock is the main thing that the spinlock debugging code uses, and
> > > SPINLOCK_DEBUG is frequently enabled by distro kernels. OTOH, the cost
> > > looks like to be +5 instructions, right? Still ...
> >
> > Which trylocks do you mean? The lockbreak spinlocks use trylock, but
> > those are not used with the ticket version.
>
> the trylocks in lib/spinlock-debug.c:
>
> static void __spin_lock_debug(spinlock_t *lock)
> {
> ...
> if (__raw_spin_trylock(&lock->raw_lock))
> return;
> ...
> void _raw_spin_lock(spinlock_t *lock)
> {
> debug_spin_lock_before(lock);
> if (unlikely(!__raw_spin_trylock(&lock->raw_lock)))
> __spin_lock_debug(lock);
> debug_spin_lock_after(lock);
> }
>
> am i missing something?

No, I missed that. Yeah, that would get a bit slower, but I'm not sure
if it would be a problem on a kernel where you have spinlock debuggin
on anyway.

If it becomes a problem, we could perhaps do a version for ticket locks
that first takes a ticket, and then is for up to a second before
printing the stuck lock message. That would make the performance hit go away.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-07-16 12:21    [W:1.961 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site