pgsql: Micro optimize LWLockAttemptLock() a bit.

Поиск
Список
Период
Сортировка
От Andres Freund
Тема pgsql: Micro optimize LWLockAttemptLock() a bit.
Дата
Msg-id E1ZLwTj-0005NP-Tj@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Micro optimize LWLockAttemptLock() a bit.

LWLockAttemptLock pointlessly read the lock's state in every loop
iteration, even though pg_atomic_compare_exchange_u32() returns the old
value. Instead do that only once before the loop iteration.

Additionally there's no need to have the expected_state variable,
old_state mostly had the same value anyway.

Noticed-By: Heikki Linnakangas
Backpatch: 9.5, no reason to let the branches diverge at this point

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a4b09af3e93707351f1d4b8efafabfa135c0f70b

Modified Files
--------------
src/backend/storage/lmgr/lwlock.c |   20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)


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

Предыдущее
От: Andres Freund
Дата:
Сообщение: pgsql: Fix issues around the "variable" support in the lwlock infrastru
Следующее
От: Andres Freund
Дата:
Сообщение: pgsql: Micro optimize LWLockAttemptLock() a bit.