Re: LWLock optimization for multicore Power machines

From: Andres Freund <andres(at)anarazel(dot)de>
To: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: LWLock optimization for multicore Power machines
Date: 2017-02-06 19:53:44
Message-ID: 20170206195344.xlegqvxhqxhsjizv@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2017-02-06 19:54:13 Re: One-shot expanded output in psql using \gx
Previous Message Corey Huinker 2017-02-06 19:50:18 Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)