Re: fix more casting away of qualifiers

From: Andres Freund <andres(at)anarazel(dot)de>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: fix more casting away of qualifiers
Date: 2026-11-03 13:40:41
Message-ID: wpaxan4siizieri4kdghdr7hyqt4ntjjxwxhco63cszvtchdyy@b7edokua4jln
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2026-11-03 11:41:34 +0100, Peter Eisentraut wrote:
> On 19.10.26 13:55, Andres Freund wrote:
> > I don't think the volatiles moved into PMSignalData are particularly
> > useful. They're precisely one of the cases where volatile is just pretending
> > to do things correctly.
>
> > Tom, is there any reason this doesn't use barriers? I assume it's just
> > because the code is "too old"?
>
> I played around with this a little bit. Using memory barriers here makes
> for very difficult to follow code, because the interacting parts are spread
> over a bunch of different functions, and so you don't get the idiomatic
>
> do one thing
> barrier
> do another thing
>
> code.
>
> If we're going to touch it, would it better to try to write this with
> atomics (with barrier semantics, as appropriate)? What is the current
> thinking on whether the barrier macros or atomics should be used?

I don't quite get it, tbh. If you can move to atomics, you need to do just
about the same analysis, no? I think using atomics is just fine, but normally
for me the analysis is about the same amount of work. Sometimes atomics are a
bit simpler, sometimes barriers, but more often than not the difference is
marginal. Sometimes explicit barrier use can be a bit faster on x86 (because
the barriers operate on non-contended memory).

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2026-11-03 13:41:31 Re: [PATCH] Fix segmentation fault caused by reentrancy in RI_Fkey_cascade_del (ri_triggers.c)
Previous Message Alexander Pyhalov 2026-11-03 13:36:33 Re: Asynchronous MergeAppend