pgsql: Prevent lwlock dtrace probes from unnecessary work

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Prevent lwlock dtrace probes from unnecessary work
Date: 2021-05-03 10:18:50
Message-ID: E1ldVf8-0006Ue-7x@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Prevent lwlock dtrace probes from unnecessary work

If dtrace is compiled in but disabled, the lwlock dtrace probes still
evaluate their arguments. Since PostgreSQL 13, T_NAME(lock) does
nontrivial work, so it should be avoided if not needed. To fix, make
these calls conditional on the *_ENABLED() macro corresponding to each
probe.

Reviewed-by: Craig Ringer <craig(dot)ringer(at)enterprisedb(dot)com>
Discussion: https://www.postgresql.org/message-id/CAGRY4nwxKUS_RvXFW-ugrZBYxPFFM5kjwKT5O+0+Stuga5b4+Q@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b94409a02f6122d77b5154e481c0819fed6b4c95

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

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2021-05-03 15:42:50 pgsql: Fix performance issue in new regex match-all detection code.
Previous Message Peter Eisentraut 2021-05-03 07:06:45 pgsql: Remove unused function argument