diff options
| author | Andres Freund | 2016-04-11 03:12:32 +0000 |
|---|---|---|
| committer | Andres Freund | 2016-04-11 03:12:32 +0000 |
| commit | 008608b9d51061b1f598c197477b3dc7be9c4a64 (patch) | |
| tree | a2284092fb36b8e7fd9d8f412fc6da4ee4c8fad2 /src/include | |
| parent | 48354581a49c30f5757c203415aa8412d85b0f70 (diff) | |
Avoid the use of a separate spinlock to protect a LWLock's wait queue.
Previously we used a spinlock, in adition to the atomically manipulated
->state field, to protect the wait queue. But it's pretty simple to
instead perform the locking using a flag in state.
Due to 6150a1b0 BufferDescs, on platforms (like PPC) with > 1 byte
spinlocks, increased their size above 64byte. As 64 bytes are the size
we pad allocated BufferDescs to, this can increase false sharing;
causing performance problems in turn. Together with the previous commit
this reduces the size to <= 64 bytes on all common platforms.
Author: Andres Freund
Discussion: CAA4eK1+ZeB8PMwwktf+3bRS0Pt4Ux6Rs6Aom0uip8c6shJWmyg@mail.gmail.com
20160327121858.zrmrjegmji2ymnvr@alap3.anarazel.de
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/storage/lwlock.h | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/include/storage/lwlock.h b/src/include/storage/lwlock.h index 5e6299af1d0..3db11e43f0d 100644 --- a/src/include/storage/lwlock.h +++ b/src/include/storage/lwlock.h @@ -57,15 +57,11 @@ typedef struct LWLockTranche */ typedef struct LWLock { - slock_t mutex; /* Protects LWLock and queue of PGPROCs */ uint16 tranche; /* tranche ID */ - pg_atomic_uint32 state; /* state of exclusive/nonexclusive lockers */ -#ifdef LOCK_DEBUG - pg_atomic_uint32 nwaiters; /* number of waiters */ -#endif dlist_head waiters; /* list of waiting PGPROCs */ #ifdef LOCK_DEBUG + pg_atomic_uint32 nwaiters; /* number of waiters */ struct PGPROC *owner; /* last exclusive owner of the lock */ #endif } LWLock; |
