Re: PGPROC alignment (was Re: pgsql: Separate RecoveryConflictReasons from procsignals)
Heikki Linnakangas <hlinnaka@iki.fi>
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: Andres Freund <andres@anarazel.de>,
"pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2026-02-11T10:03:51Z
Lists: pgsql-hackers
Attachments
- pahole-PGPROC.txt (text/plain)
On 11/02/2026 06:40, Bertrand Drouvot wrote: > A few comments: > > 0001: > > + * and (b) to make the multiplication / division to convert between PGPROC * > + * and ProcNumber be a little cheaper > > Is that correct if PGPROC size is not a power of 2? You're right, it's not. > 0002: Good catch! Committed that. >> With this, sizeof(PGPROC) == 864 without the explicit alignment to >> PG_CACHE_LINE_SIZE, and 896 with it. > > I can see 876 -> 896 on my side: > > /* 872 | 4 */ uint32 wait_event_info; > /* XXX 20-byte padding */ > > /* total size (bytes): 896 */ > } Interesting. I've attached 'pahole bin/postgres' output from my laptop. It's Linux on arm64. This is with my v2 patches to rearrange the fields, but with the "pg_attribute_aligned(PG_CACHE_LINE_SIZE)" removed. - Heikki
Commits
-
Use C11 alignas in typedef definitions
- 5c2a8d272b9a 19 (unreleased) landed
-
Align PGPROC to cache line boundary
- 412f78c66eed 19 (unreleased) landed
-
Rearrange fields in PGPROC, for clarity
- 2e0853176f8f 19 (unreleased) landed
-
Split PGPROC 'links' field into two, for clarity
- 36bbcd5be3ff 19 (unreleased) landed
-
Remove useless store to local variable
- ab32a9e21d37 19 (unreleased) landed
-
Separate RecoveryConflictReasons from procsignals
- 17f51ea81875 19 (unreleased) cited