Re: Throwing away unnecessary spin-locks

From: Alexandre Felipe <o(dot)alexandre(dot)felipe(at)gmail(dot)com>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Throwing away unnecessary spin-locks
Date: 2026-10-02 12:16:37
Message-ID: CAE8JnxOQjWEkOyW8ZaZNUDtQ5ixa823U6h_C47UazX03aUVHkQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Shihao,

On Fri, Oct 2, 2026 at 6:30 AM shihao zhong <zhong950419(at)gmail(dot)com> wrote:

>
> I think the safer route is what recent commits like df3978c2340 did,
> convert the field to pg_atomic and use pg_atomic_read_membarrier_u32()
> and pg_atomic_write_membarrier_u32().
>

Actually, v1 conflicted with that commit, rebasing.

The reason I didn't want to do that is that I wanted a uniform way to handle
all types.

v1.1 pg_atomic_{write,read}_membarrier_uint{32,64} and keeps the
lock for 8- and 16-bits.

Can we use pg_atomic_flag for bool, or will that have different
representations?

Regards,
Alexandre felipe

Attachment Content-Type Size
v1.1-0002-replace-slock_-read-write-_.patch application/octet-stream 24.6 KB
v1.1-0001-Spare-locks-for-uint32-and-uint64.patch application/octet-stream 4.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-10-02 13:19:54 Re: Throwing away unnecessary spin-locks
Previous Message Ayush Tiwari 2026-10-02 11:08:17 Re: PANIC serves too many masters