Re: PGPROC alignment (was Re: pgsql: Separate RecoveryConflictReasons from procsignals)

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PGPROC alignment (was Re: pgsql: Separate RecoveryConflictReasons from procsignals)
Date: 2026-02-11 10:03:51
Message-ID: 787be980-0878-4f4a-be01-d042ab5d370e@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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

Attachment Content-Type Size
pahole-PGPROC.txt text/plain 4.5 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Dean Rasheed 2026-02-11 10:27:44 pgsql: doc: Clarify RLS policies applied for ON CONFLICT DO NOTHING.
Previous Message Heikki Linnakangas 2026-02-11 10:03:44 pgsql: Remove useless store to local variable

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-02-11 10:10:50 Re: [Patch] add new parameter to pg_replication_origin_session_setup
Previous Message Tatsuo Ishii 2026-02-11 09:58:47 Questionable description about character sets