Re: Lockless queue of waiters in LWLock

Поиск
Список
Период
Сортировка
От Alexander Korotkov
Тема Re: Lockless queue of waiters in LWLock
Дата
Msg-id CAPpHfduRgLH9a+U=6pYR7KawCosNO764ojCZkSajdFAbbE8sgQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Lockless queue of waiters in LWLock  (Andres Freund <andres@anarazel.de>)
Ответы Re: Lockless queue of waiters in LWLock  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Hi, Andres!

On Fri, Nov 4, 2022 at 10:07 PM Andres Freund <andres@anarazel.de> wrote:
> The use of cmpxchg vs lock inc/lock add/xadd is one of the major reasons why
> lwlocks are slower than a spinlock (but obviously are better under contention
> nonetheless).
>
>
> I have a benchmark program that starts a thread for each physical core and
> just increments a counter on an atomic value.

Thank you for this insight!  I didn't know xadd is much cheaper than
cmpxchg unless there are retries.  I also wonder how cmpxchg becomes
faster with higher concurrency.

------
Regards,
Alexander Korotkov



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

Предыдущее
От: Pavel Luzanov
Дата:
Сообщение: Re: Add proper planner support for ORDER BY / DISTINCT aggregates
Следующее
От: John Naylor
Дата:
Сообщение: Re: [PoC] Improve dead tuple storage for lazy vacuum