Little cleanup: Move ProcStructLock to the ProcGlobal struct

Heikki Linnakangas <hlinnaka@iki.fi>

From: Heikki Linnakangas <hlinnaka@iki.fi>
To: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2026-02-10T17:39:17Z
Lists: pgsql-hackers

Attachments

For some reason, the ProcStructLock spinlock is allocated in a shared 
memory area of its own:

     /* Create ProcStructLock spinlock, too */
     ProcStructLock = (slock_t *) ShmemInitStruct("ProcStructLock spinlock",
                                                  sizeof(slock_t),
                                                  &found);
     SpinLockInit(ProcStructLock);

I believe that's just for historical reasons. A long long time ago, 
spinlocks had to be allocated separately rather than embedded in other 
structs.

The spinlock protects the freeProcs list and some other fields in 
ProcGlobal, so let's put it together with those fields. It's good for 
cache locality to have it next to the thing it protects, and just makes 
more sense anyway.

Any objections?

- Heikki

Commits

  1. Move ProcStructLock to the ProcGlobal struct