Re: Spinlocks, yet again: analysis and proposed patches

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Marko Kreen <marko(at)l-t(dot)ee>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Spinlocks, yet again: analysis and proposed patches
Date: 2005-09-13 14:24:17
Message-ID: 87br2x11wu.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Marko Kreen <marko(at)l-t(dot)ee> writes:

> On Sun, Sep 11, 2005 at 05:59:49PM -0400, Tom Lane wrote:
> > The second reason that the futex patch is helping is that when
> > a spinlock delay does occur, it allows the delaying process to be
> > awoken almost immediately, rather than delaying 10 msec or more
> > as the existing code does. However, given that we are only expecting
> > the spinlock to be held for a couple dozen instructions, using the
> > kernel futex mechanism is huge overkill --- the in-kernel overhead
> > to manage the futex state is almost certainly several orders of
> > magnitude more than the delay we actually want.
>
> Why do you think so? AFAIK on uncontented case there will be no
> kernel access, only atomic inc/dec. On contented case you'll
> want task switch anyway, so the futex managing should not
> matter. Also this mechanism is specifically optimized for
> inter-process locking, I don't think you can get more efficient
> mechanism from side-effects from generic syscalls.
>
> If you don't want Linux-specific locking in core code, then
> it's another matter...

How does the futex using code compare with the new patches on this new
benchmark test?

--
greg

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-09-13 14:39:38 Re: Spinlocks, yet again: analysis and proposed patches
Previous Message Tom Lane 2005-09-13 14:10:13 Re: Spinlocks, yet again: analysis and proposed patches