]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Move shmem allocator's fields from PGShmemHeader to its own struct
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 30 Jan 2026 16:22:56 +0000 (18:22 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 30 Jan 2026 16:22:56 +0000 (18:22 +0200)
commite2362eb2bd1459319dacaeaa5dc886dbca546b96
tree772c3c5cb1aeca94dde509f899e2eccf893e2616
parente76221bd95f0428cc9b5872a4bcbf0b7e40b77b0
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.com
src/backend/port/sysv_shmem.c
src/backend/port/win32_shmem.c
src/backend/postmaster/launch_backend.c
src/backend/storage/ipc/ipci.c
src/backend/storage/ipc/shmem.c
src/include/storage/pg_shmem.h
src/include/storage/shmem.h
src/tools/pgindent/typedefs.list