Re: Spinlocks, yet again: analysis and proposed patches - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Spinlocks, yet again: analysis and proposed patches
Date
Msg-id KGEFLMPJFBNNLNOOOPLGMEPOCIAA.simon@2ndquadrant.com
Whole thread Raw
In response to Re: Spinlocks, yet again: analysis and proposed patches  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> Tom Lane wrote
> I'm going to go ahead and make that change, since it doesn't
> seem likely
> to have any downside.  It might be interesting to look into forcing
> proper alignment of the shared buffer headers as well.

Just catching up on your mails - all of that sounds good so far.

Everything mentioned so far talks about spinlocks in the general sense,
rather than with respect to particular locks.

The different lock types we have are held for different amounts of time
and are also subject to differing amounts of contention. I think it
would be useful to put in a capability to tune each class of lock
according to the possibility for delay and contention on it.

Long delay, low contention e.g. CheckpointLock => waiter should sleep
immediately
Medium delay, high contention e.g. WALWriteLock => waiter spins if at
head of queue, else sleeps immediately
Short delay, high contention e.g. BufMappingLock => waiter spins and
retries forever, cos the lock is coming soon
Short delay, low contention, sometimes long waits at end of VACUUM
e.g. FreeSpaceLock => waiter spins, then eventually sleeps

I'm not sure whether you'll agree with my characterisation of these
locks, but the main thing I'm trying to get across is that
once-size-fits-all isn't the optimal approach. I'm not saying either
that we end up with individual characterisations for each lock type, but
a few key ones could be catered for differently.

Best Regards, Simon Riggs



pgsql-hackers by date:

Previous
From: Gavin Sherry
Date:
Subject: Re: Spinlocks, yet again: analysis and proposed patches
Next
From: Tom Lane
Date:
Subject: Re: Spinlocks, yet again: analysis and proposed patches