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

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
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-23 16:13:29
Message-ID: d7a788fa-e609-4894-a8be-2f70e135424f@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 13.02.26 09:03, Bertrand Drouvot wrote:
> +/*
> + * If compiler understands aligned pragma, use it to align the struct at cache
> + * line boundaries. This is just for performance, to (a) avoid false sharing
> + * and (b) to make the multiplication / division to convert between PGPROC *
> + * and ProcNumber be a little cheaper.
> + */
> +#if defined(pg_attribute_aligned)
> + pg_attribute_aligned(PG_CACHE_LINE_SIZE)
> +#endif
> +PGPROC;

You can/should use C11 standard alignas(), so you don't need to worry
about whether it's supported or not.

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2026-02-23 16:20:21 pgsql: Disallow CR and LF in database, role, and tablespace names
Previous Message Peter Eisentraut 2026-02-23 15:51:38 pgsql: meson: allow disabling building/installation of static libraries

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2026-02-23 16:41:29 Re: Moving the vacuum GUCs' docs out of the Client Connection Defaults section
Previous Message Tom Lane 2026-02-23 16:04:57 Re: meson: Allow disabling static libraries