Re: Remove Instruction Synchronization Barrier in spin_delay() for ARM64 architecture

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Salvatore Dipietro <dipietro(dot)salvatore(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Salvatore Dipietro <dipiets(at)amazon(dot)com>, blakgeof(at)amazon(dot)com
Subject: Re: Remove Instruction Synchronization Barrier in spin_delay() for ARM64 architecture
Date: 2025-08-15 17:57:52
Message-ID: aJ91IK8h3x8B-9WA@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 15, 2025 at 01:39:52PM -0400, Andres Freund wrote:
> On 2025-08-14 11:29:08 +0200, Álvaro Herrera wrote:
>> However, changing that spinlock to an lwlock doesn't look easy, because of
>> the way each pgss entry is created as a dynahash entry, and then deallocated
>> from there. With spinlocks we can just reinit the spinlock each time, but
>> that doesn't work with lwlocks. We have no easy way to associate then
>> disassociate each entry from a specific lwlock.
>
> I'm not following? The lwlock can just be inside the struct, just like the
> spinlock is? "Association" is just LWLockInitialize() and deassociation is not
> needed.

Indeed. I rebased an old patch that I had lying around to demonstrate. If
my past testing [0] is to be trusted, this actually hurts performance,
unfortunately.

[0] https://postgr.es/m/Zs4hJ6-Fg8DMgU_P@nathan

--
nathan

Attachment Content-Type Size
v1-0001-replace-p_s_s-entry-spinlocks-with-lwlocks.patch text/plain 3.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Burd, Greg 2025-08-15 17:58:17 Re: `pg_ctl init` crashes when run concurrently; semget(2) suspected
Previous Message Timur Magomedov 2025-08-15 17:45:10 Re: [WIP]Vertical Clustered Index (columnar store extension) - take2