Re: Improving spin-lock implementation on ARM.

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Krunal Bauskar <krunalbauskar(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Improving spin-lock implementation on ARM.
Date: 2020-11-26 10:32:37
Message-ID: 16697830-4e15-5b4e-9698-f5be30eec363@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 26/11/2020 06:30, Krunal Bauskar wrote:
> Improving spin-lock implementation on ARM.
> ------------------------------------------------------------
>
> * Spin-Lock is known to have a significant effect on performance
>   with increasing scalability.
>
> * Existing Spin-Lock implementation for ARM is sub-optimal due to
>   use of TAS (test and swap)
>
> * TAS is implemented on ARM as load-store so even if the lock is not free,
>   store operation will execute to replace the same value.
>   This redundant operation (mainly store) is costly.
>
> * CAS is implemented on ARM as load-check-store-check that means if the
>   lock is not free, check operation, post-load will cause the loop to
>   return there-by saving on costlier store operation. [1]

Can you add some code comments to explain that why CAS is cheaper than
TAS on ARM?

Is there some official ARM documentation, like a programmer's reference
manual or something like that, that would show a reference
implementation of a spinlock on ARM? It would be good to refer to an
authoritative source on this.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2020-11-26 10:44:21 Re: [Proposal] Global temporary tables
Previous Message Julien Rouhaud 2020-11-26 10:16:17 Re: [Proposal] Global temporary tables