[haiku-gsoc] Re: Implementation Queries
- From: Julian Harnath <julian.harnath@xxxxxxxxxxxxxx>
- To: <haiku-gsoc@xxxxxxxxxxxxx>
- Date: Tue, 20 Jun 2017 21:05:08 +0200
Hey Vivek,
On 20.06.2017 10:18, Vivek Roy wrote:
Also,
I have made some changes to my previous implementation of asm/atomic.h
Julian, please check
<https://github.com/vivek-roy/haiku/commit/b1b90b0201cfa8a1300d232762892cb6c56a8d11>.
The problem with atomic_swap_int() has already been pointed out, but I
wonder why you went with these instead of the GCC builtins after all?
Haiku's atomic functions unfortunately don't allow specifying a memory
order, so they use barriers stronger than would be necessary here. For
example, atomic_test_and_set() and atomic_and() use full sequential
consistency, but the two FreeBSD functions that you've used them for
here don't require barriers at all.
On x86/x64 this doesn't make so much of a difference, but on platforms
with weaker memory models, such as ARM and PPC, this can lead to a large
performance loss.
Regards
Julian
Other related posts: