pgsql: Change the spinlock primitives to function as compiler barriers.

Поиск
Список
Период
Сортировка
От Robert Haas
Тема pgsql: Change the spinlock primitives to function as compiler barriers.
Дата
Msg-id E1XRTJl-00080P-Ir@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Change the spinlock primitives to function as compiler barriers.

Previously, they functioned as barriers against CPU reordering but not
compiler reordering, an odd API that required extensive use of volatile
everywhere that spinlocks are used.  That's error-prone and has negative
implications for performance, so change it.

In theory, this makes it safe to remove many of the uses of volatile
that we currently have in our code base, but we may find that there are
some bugs in this effort when we do.  In the long run, though, this
should make for much more maintainable code.

Patch by me.  Review by Andres Freund.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/0709b7ee72e4bc71ad07b7120acd117265ab51d0

Modified Files
--------------
src/backend/storage/lmgr/s_lock.c |   12 ++++++
src/include/storage/s_lock.h      |   83 ++++++++++++++++++++++++++++++-------
2 files changed, 79 insertions(+), 16 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Add width_bucket(anyelement, anyarray).
Следующее
От: Andres Freund
Дата:
Сообщение: pgsql: Fix spinlock implementation for some !solaris sparc platforms.