Re: spinlocks: generalizing "non-locking test"

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: spinlocks: generalizing "non-locking test"
Дата
Msg-id 16451.1098201712@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: spinlocks: generalizing "non-locking test"  (Neil Conway <neilc@samurai.com>)
Список pgsql-hackers
Neil Conway <neilc@samurai.com> writes:
> Granted, but I think you've mostly conceded my point: every _subsequent_
> time TAS() is invoked, the non-locking test is a clear win (with the
> possible exception of PPC).

I'm not real sure.  One point here is that the standard advice about
this stuff is generally thinking in terms of an *extremely* tight spin
loop, ie
while (TAS(lock))    ;

The loop in s_lock.c has a bit more overhead than that.  Also, because
we only use spinlocks to protect LWLocks, the expected hold time for a
spinlock is just a couple dozen instructions, which is probably less
than the expected time in most other uses of spinlocks.  So I think it's
less than clear that we should expect TAS to fail, even within the loop.

Basically I'd like to see some tests proving that there's actually any
value in it before we go complicating the assembly-code API ...
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re:
Следующее
От: Andreas Pflug
Дата:
Сообщение: Re: Time off