Re: Patch: fix lock contention for HASHHDR.mutex - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Patch: fix lock contention for HASHHDR.mutex
Date
Msg-id 20151217151418.GB2224@awork2.anarazel.de
Whole thread Raw
In response to Re: Patch: fix lock contention for HASHHDR.mutex  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Patch: fix lock contention for HASHHDR.mutex  (Aleksander Alekseev <a.alekseev@postgrespro.ru>)
Re: Patch: fix lock contention for HASHHDR.mutex  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
On 2015-12-17 09:47:57 -0500, Robert Haas wrote:
> On Tue, Dec 15, 2015 at 7:25 AM, Andres Freund <andres@anarazel.de> wrote:
> > I'd consider using a LWLock instead of a spinlock here. I've seen this
> > contended in a bunch of situations, and the queued behaviour, combined
> > with directed wakeups on the OS level, ought to improve the worst case
> > behaviour measurably.
> 
> Amit had the idea a while back of trying to replace the HASHHDR mutex
> with something based on atomic ops.  It seems hard to avoid the
> attendant A-B-A problems but maybe there's a way.

It'd really like to see it being replaced by a queuing lock
(i.e. lwlock) before we go there. And then maybe partition the freelist,
and make nentries an atomic.  Just doing those might already be good
enough and should be a lot easier.

Andres



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Patch: fix lock contention for HASHHDR.mutex
Next
From: Tomas Vondra
Date:
Subject: Re: WIP: bloom filter in Hash Joins with batches