Hi, On 2017-02-03 20:01:03 +0300, Alexander Korotkov wrote: > Using assembly in lwlock.c looks rough. This is why I refactored it by > introducing new atomic operation pg_atomic_fetch_mask_add_u32 (see > lwlock-power-2.patch). It checks that all masked bits are clear and then > adds to variable. This atomic have special assembly implementation for > Power, and generic implementation for other platforms with loop of CAS. > Probably we would have other implementations for other architectures in > future. This level of abstraction is the best I managed to invent.
I think that's a reasonable approach. And I think it might be worth experimenting with a more efficient implementation on x86 too, using hardware lock elision / HLE and/or tsx. Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers