Refactor shared memory allocation for semaphores

Heikki Linnakangas <heikki.linnakangas@iki.fi>

Commit: aa9c5fd3e3d7f1e6154474e39ab71377136d463a
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2025-11-06T12:45:00Z
Refactor shared memory allocation for semaphores

Before commit e25626677f, spinlocks were implemented using semaphores
on some platforms (--disable-spinlocks). That made it necessary to
initialize semaphores early, before any spinlocks could be used. Now
that we don't support --disable-spinlocks anymore, we can allocate the
shared memory needed for semaphores the same way as other shared
memory structures. Since the semaphores are used only in the PGPROC
array, move the semaphore shmem size estimation and initialization
calls to ProcGlobalShmemSize() and InitProcGlobal().

Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAExHW5seSZpPx-znjidVZNzdagGHOk06F+Ds88MpPUbxd1kTaA@mail.gmail.com

Files

Discussion