From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@postgresql.org
Subject: pgsql: Micro optimize LWLockAttemptLock() a bit.
Date: Sun, 02 Aug 2015 16:51:18 +0000
Message-ID: <E1ZLwTm-0005Nv-GR@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
------
REL9_5_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/9074e41dbd41bc45ef79aeac1b6496bf087509a7
Modified Files
--------------
src/backend/storage/lmgr/lwlock.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de
Subject: Re: pgsql: Micro optimize LWLockAttemptLock() a bit.
In-Reply-To: <E1ZLwTm-0005Nv-GR@gemulon.postgresql.org>
References: <E1ZLwTm-0005Nv-GR@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox