Re: optimize atomic exchanges

2023-12-18 Thread Nathan Bossart
On Fri, Dec 15, 2023 at 04:56:27AM -0800, Andres Freund wrote: > I don't think we need the inline asm. Otherwise looks good. Committed with that change. Thanks for reviewing! I am going to watch the buildfarm especially closely for this one. -- Nathan Bossart Amazon Web Services: https://aws.a

Re: optimize atomic exchanges

2023-12-15 Thread Andres Freund
Hi, On 2023-12-04 15:08:57 -0600, Nathan Bossart wrote: > On Mon, Dec 04, 2023 at 12:18:05PM -0600, Nathan Bossart wrote: > > Barring objections or additional feedback, I think I'm inclined to press > > forward with this one and commit it in the next week or two. I'm currently > > planning to kee

Re: optimize atomic exchanges

2023-12-04 Thread Nathan Bossart
On Mon, Dec 04, 2023 at 12:18:05PM -0600, Nathan Bossart wrote: > Barring objections or additional feedback, I think I'm inclined to press > forward with this one and commit it in the next week or two. I'm currently > planning to keep the inline assembly, but I'm considering removing the > configu

Re: optimize atomic exchanges

2023-12-04 Thread Nathan Bossart
On Thu, Nov 30, 2023 at 10:35:22PM -0600, Nathan Bossart wrote: > One thing on my mind is whether we should bother with the inline assembly > versions. It looks like gcc has had __atomic since 4.7.0 (2012), so I'm > not sure we gain much from them. OTOH they are pretty simple and seem > unlikely

Re: optimize atomic exchanges

2023-11-30 Thread Nathan Bossart
On Thu, Nov 30, 2023 at 07:56:27PM -0800, Andres Freund wrote: > On 2023-11-30 21:18:15 -0600, Nathan Bossart wrote: >> Some rudimentary tests show a >40% speedup with this patch on x86_64. > > On bigger machines, with contention, the wins are likely much higher. I see > two orders of magnitude hi

Re: optimize atomic exchanges

2023-11-30 Thread Andres Freund
Hi, On 2023-11-30 21:18:15 -0600, Nathan Bossart wrote: > On Wed, Nov 29, 2023 at 03:29:05PM -0600, Nathan Bossart wrote: > > I haven't done any sort of performance testing on this yet. Some > > preliminary web searches suggest that there is unlikely to be much > > difference between cmpxchg and

Re: optimize atomic exchanges

2023-11-30 Thread Nathan Bossart
On Wed, Nov 29, 2023 at 03:29:05PM -0600, Nathan Bossart wrote: > I haven't done any sort of performance testing on this yet. Some > preliminary web searches suggest that there is unlikely to be much > difference between cmpxchg and xchg, but presumably there's some difference > between xchg and d

optimize atomic exchanges

2023-11-29 Thread Nathan Bossart
On Fri, Nov 10, 2023 at 08:55:29PM -0600, Nathan Bossart wrote: > On Fri, Nov 10, 2023 at 06:48:39PM -0800, Andres Freund wrote: >> Yes. We should optimize pg_atomic_exchange_u32() one of these days - it can >> be >> done *far* faster than a cmpxchg. When I was adding the atomic abstraction >> the