pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor shared memory allocation for semaphores
Date: Thu, 06 Nov 2025 12:46:10 +0000
Message-ID: <E1vGzNS-005IKr-0c@gemulon.postgresql.org> (raw)

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...

Branch
------
master

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

Modified Files
--------------
src/backend/port/posix_sema.c   |  6 +-----
src/backend/port/sysv_sema.c    |  6 +-----
src/backend/storage/ipc/ipci.c  | 31 +++++--------------------------
src/backend/storage/ipc/shmem.c |  3 ++-
src/backend/storage/lmgr/proc.c |  4 ++++
src/include/storage/ipc.h       |  2 +-
src/include/storage/shmem.h     |  1 -
7 files changed, 14 insertions(+), 39 deletions(-)



Message-ID: <E1vGzNS-005IKr-0c@gemulon.postgresql.org>
Permalink:  ../E1vGzNS-005IKr-0c@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vGzNS-005IKr-0c@gemulon.postgresql.org

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Refactor shared memory allocation for semaphores
  In-Reply-To: <E1vGzNS-005IKr-0c@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