Re: Better LWLocks with compare-and-swap (9.4)

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Better LWLocks with compare-and-swap (9.4)
Date: 2013-05-13 14:21:27
Message-ID: CAHyXU0x+oYbf1=wYX_=DdsgmmDdQ9yQTm2A469DZRJqs1u-BvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, May 13, 2013 at 7:50 AM, Heikki Linnakangas
<hlinnakangas(at)vmware(dot)com> wrote:
> The attached patch is still work-in-progress. There needs to be a configure
> test and fallback to spinlock if a CAS instruction is not available. I used
> the gcc __sync_val_compare_and_swap() builtin directly, that needs to be
> abstracted. Also, in the case that the wait queue needs to be manipulated,
> the code spins on the CAS instruction, but there is no delay mechanism like
> there is on a regular spinlock; that needs to be added in somehow.

These are really interesting results. Why is the CAS method so much
faster then TAS? Did you see any contention?

merlin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2013-05-13 14:26:51 Re: lock support for aarch64
Previous Message Tom Lane 2013-05-13 14:02:43 Re: Add more regression tests for dbcommands