From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Move shmem allocator's fields from PGShmemHeader to its own stru
Date: Fri, 30 Jan 2026 16:27:04 +0000
Message-ID: <E1vlrKp-000BTA-2T@gemulon.postgresql.org> (raw)
Move shmem allocator's fields from PGShmemHeader to its own struct
For readability. It was a slight modularity violation to have fields
in PGShmemHeader that were only used by the allocator code in
shmem.c. And it was inconsistent that ShmemLock was nevertheless not
stored there. Moving all the allocator-related fields to a separate
struct makes it more consistent and modular, and removes the need to
allocate and pass ShmemLock separately via BackendParameters.
Merge InitShmemAccess() and InitShmemAllocation() into a single
function that initializes the struct when called from postmaster, and
when called from backends in EXEC_BACKEND mode, re-establishes the
global variables. That's similar to all the *ShmemInit() functions
that we have.
Co-authored-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAExHW5uNRB9oT4pdo54qAo025MXFX4MfYrD9K15OCqe-ExnNvg@mail.gmail...
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/e2362eb2bd1459319dacaeaa5dc886dbca546b96
Modified Files
--------------
src/backend/port/sysv_shmem.c | 2 +-
src/backend/port/win32_shmem.c | 2 +-
src/backend/postmaster/launch_backend.c | 7 +-
src/backend/storage/ipc/ipci.c | 4 +-
src/backend/storage/ipc/shmem.c | 163 +++++++++++++++-----------------
src/include/storage/pg_shmem.h | 4 +-
src/include/storage/shmem.h | 3 +-
src/tools/pgindent/typedefs.list | 1 +
8 files changed, 83 insertions(+), 103 deletions(-)
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: Move shmem allocator's fields from PGShmemHeader to its own stru
In-Reply-To: <E1vlrKp-000BTA-2T@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