Re: Atomics for heap_parallelscan_nextpage()

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org,Robert Haas <robertmhaas(at)gmail(dot)com>,Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>,David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>,PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>,Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>,Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Subject: Re: Atomics for heap_parallelscan_nextpage()
Date: 2017-08-16 17:56:20
Message-ID: 6D22F966-071D-4C92-9A1D-18B6901BDD6F@anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On August 16, 2017 10:47:23 AM PDT, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>On Wed, Aug 16, 2017 at 1:40 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I was wondering why the shm_toc code was using BUFFERALIGN and not
>> MAXALIGN, and I now suspect that the answer is "it's an entirely
>> undocumented kluge to make the atomics code not crash on 32-bit
>> machines, so long as nobody puts a pg_atomic_uint64 anywhere except
>> in a shm_toc".
>
>Well, shm_toc considerably predates 64-bit atomics, so I think the
>causality cannot run in that direction. shm_toc.c first appeared in
>the tree in January of 2014. src/include/port/atomics didn't show up
>until September of that year, and 64-bit atomics weren't actually
>usable in practice until e8fdbd58fe564a29977f4331cd26f9697d76fc40 in
>April of 2017.

Well, not for core code. I certainly know about production code using it, because crusty platforms are considered irrelevant...

Independent of that, a comment explaining what the BUFFERALIGN is intending would be good.

Andres
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-08-16 18:00:32 Re: Atomics for heap_parallelscan_nextpage()
Previous Message Robert Haas 2017-08-16 17:49:42 Re: Atomics for heap_parallelscan_nextpage()