pgsql: Use the new shmem allocation functions in a few core subsystems

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use the new shmem allocation functions in a few core subsystems
Date: 2026-04-05 23:27:44
Message-ID: E1w9WsZ-0039A5-0W@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use the new shmem allocation functions in a few core subsystems

These subsystems have some complicating properties, making them
slightly harder to convert than most:

- The initialization callbacks of some of these subsystems have
dependencies, i.e. they need to be initialized in the right order.

- The ProcGlobal pointer still needs to be inherited by the
BackendParameters mechanism on EXEC_BACKEND builds, because
ProcGlobal is required by InitProcess() to get a PGPROC entry, and
the PGPROC entry is required to use LWLocks, and usually attaching
to shared memory areas requires the use of LWLocks.

- Similarly, ProcSignal pointer still needs to be handled by
BackendParameters, because query cancellation connections access it
without calling InitProcess

Reviewed-by: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Reviewed-by: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Reviewed-by: Daniel Gustafsson <daniel(at)yesql(dot)se>
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/access/transam/twophase.c | 2 +-
src/backend/access/transam/varsup.c | 35 +++---
src/backend/port/posix_sema.c | 22 ++--
src/backend/port/sysv_sema.c | 21 ++--
src/backend/port/win32_sema.c | 11 +-
src/backend/storage/ipc/dsm.c | 64 ++++++-----
src/backend/storage/ipc/dsm_registry.c | 36 ++++---
src/backend/storage/ipc/ipci.c | 28 -----
src/backend/storage/ipc/latch.c | 8 +-
src/backend/storage/ipc/pmsignal.c | 51 +++++----
src/backend/storage/ipc/procarray.c | 110 +++++++++----------
src/backend/storage/ipc/procsignal.c | 64 ++++++-----
src/backend/storage/ipc/sinvaladt.c | 38 +++----
src/backend/storage/lmgr/proc.c | 191 +++++++++++++++++----------------
src/backend/utils/hash/dynahash.c | 3 +-
src/include/access/transam.h | 2 -
src/include/storage/dsm.h | 3 -
src/include/storage/dsm_registry.h | 2 -
src/include/storage/pg_sema.h | 6 +-
src/include/storage/pmsignal.h | 2 -
src/include/storage/proc.h | 2 -
src/include/storage/procarray.h | 2 -
src/include/storage/procsignal.h | 3 -
src/include/storage/sinvaladt.h | 2 -
src/include/storage/subsystemlist.h | 17 ++-
25 files changed, 344 insertions(+), 381 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-04-05 23:52:37 pgsql: Add tests for lock statistics, take two
Previous Message Heikki Linnakangas 2026-04-05 23:27:43 pgsql: Convert pg_stat_statements to use the new shmem allocation funct