Move PinBuffer and UnpinBuffer to atomics

Поиск
Список
Период
Сортировка
От YUriy Zhuravlev
Тема Move PinBuffer and UnpinBuffer to atomics
Дата
Msg-id 2400449.GjM57CE0Yg@dinodell
обсуждение исходный текст
Ответы Re: Move PinBuffer and UnpinBuffer to atomics  (Andres Freund <andres@anarazel.de>)
Re: Move PinBuffer and UnpinBuffer to atomics  (David Rowley <david.rowley@2ndquadrant.com>)
Список pgsql-hackers
Hello hackers!

Continuing the theme: http://www.postgresql.org/message-id/3368228.mTSz6V0Jsq@dinodell

This time, we fairly rewrote  'refcount' and 'usage_count' to atomic in
PinBuffer and UnpinBuffer (but save lock for buffer flags in Unpin).

In the same time it doesn't affect to correctness of buffer manager
because that variables already have LWLock on top of them (for partition of
hashtable). If someone pinned buffer after the call StrategyGetBuffer we just
try again (in BufferAlloc).  Also in the code there is one more check before
deleting the old buffer, where changes can be rolled back. The other functions
where it is checked 'refcount' and 'usage_count' put exclusive locks.

Also stress test with 256 KB shared memory ended successfully.

Without patch we have 417523 TPS and with patch 965821 TPS for big x86 server.
All details here: https://gist.github.com/stalkerg/773a81b79a27b4d5d63f

Thank you.
--
YUriy Zhuravlev
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Вложения

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

Предыдущее
От: Etsuro Fujita
Дата:
Сообщение: Comment update to pathnode.c
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal: function parse_ident