Re: typo in fallback implementation for pg_atomic_test_set_flag()

From: Andres Freund <andres(at)anarazel(dot)de>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: typo in fallback implementation for pg_atomic_test_set_flag()
Date: 2023-11-15 03:17:32
Message-ID: 20231115031732.pd3tgqgjzloskp5s@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2023-11-13 21:54:39 -0600, Nathan Bossart wrote:
> I noticed that the fallback pg_atomic_test_set_flag_impl() implementation
> that uses atomic-exchange is giving pg_atomic_exchange_u32_impl() an extra
> argument. This appears to be copy/pasted from the atomic-compare-exchange
> version a few lines down. It looks like it's been this way since this code
> was introduced in commit b64d92f (2014). Patch attached.

Oops.

I guess it's not too surprising this wasn't required - if the compiler has any
atomic intrinsics it's going to have support for the flag stuff. And there's
practically no compiler that

Are you planning to apply the fix?

> I'd ordinarily suggest removing this section of code since it doesn't seem
> to have gotten much coverage

Which section precisely?

> but I'm actually looking into adding some faster atomic-exchange
> implementations that may activate this code for certain
> compiler/architecture combinations.

Hm. I don't really see how adding a faster atomic-exchange implementation
could trigger this implementation being used?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amul Sul 2023-11-15 03:57:18 Re: retire MemoryContextResetAndDeleteChildren backwards compatibility macro
Previous Message torikoshia 2023-11-15 02:58:38 Re: Add new option 'all' to pg_stat_reset_shared()