pgsql: Use a separate spinlock to protect LWLockTranches

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use a separate spinlock to protect LWLockTranches
Date: 2026-03-26 22:03:58
Message-ID: E1w5so1-001bOF-1A@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use a separate spinlock to protect LWLockTranches

Previously we reused the shmem allocator's ShmemLock to also protect
lwlock.c's shared memory structures. Introduce a separate spinlock for
lwlock.c for the sake of modularity. Now that lwlock.c has its own
shared memory struct (LWLockTranches), this is easy to do.

Reviewed-by: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/47aaf57e-1b7b-4e12-bda2-0316081ff50e@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/12e3e0f2c8f7a47902b4c201ac31a12390f75657

Modified Files
--------------
src/backend/storage/ipc/shmem.c | 8 +++-----
src/backend/storage/lmgr/lwlock.c | 26 +++++++++++++-------------
src/include/storage/shmem.h | 1 -
3 files changed, 16 insertions(+), 19 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2026-03-27 00:54:47 pgsql: pg_plan_advice: pgindent
Previous Message Heikki Linnakangas 2026-03-26 21:46:49 pgsql: Rename MAX_NAMED_TRANCHES to MAX_USER_DEFINED_TRANCHES