diff options
| author | Tom Lane | 2001-09-29 04:02:27 +0000 |
|---|---|---|
| committer | Tom Lane | 2001-09-29 04:02:27 +0000 |
| commit | 499abb0c0f21cb861c5af1d49a06469f3cfcc1eb (patch) | |
| tree | 0af6262d9b6d1159315e93e90e69047b959ea5f5 /src/backend/storage/ipc/ipci.c | |
| parent | 818fb55ac49b4b20e65d9899fc1784e54e86db58 (diff) | |
Implement new 'lightweight lock manager' that's intermediate between
existing lock manager and spinlocks: it understands exclusive vs shared
lock but has few other fancy features. Replace most uses of spinlocks
with lightweight locks. All remaining uses of spinlocks have very short
lock hold times (a few dozen instructions), so tweak spinlock backoff
code to work efficiently given this assumption. All per my proposal on
pghackers 26-Sep-01.
Diffstat (limited to 'src/backend/storage/ipc/ipci.c')
| -rw-r--r-- | src/backend/storage/ipc/ipci.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c index 06988baf345..7dac93f3a03 100644 --- a/src/backend/storage/ipc/ipci.c +++ b/src/backend/storage/ipc/ipci.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.42 2001/08/25 18:52:42 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.43 2001/09/29 04:02:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -22,6 +22,7 @@ #include "storage/bufmgr.h" #include "storage/freespace.h" #include "storage/lmgr.h" +#include "storage/lwlock.h" #include "storage/proc.h" #include "storage/sinval.h" #include "storage/spin.h" @@ -53,7 +54,7 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int maxBackends) size += LockShmemSize(maxBackends); size += XLOGShmemSize(); size += CLOGShmemSize(); - size += SLockShmemSize(); + size += LWLockShmemSize(); size += SInvalShmemSize(maxBackends); size += FreeSpaceShmemSize(); #ifdef STABLE_MEMORY_STORAGE @@ -74,14 +75,25 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int maxBackends) /* * First initialize spinlocks --- needed by InitShmemAllocation() */ - CreateSpinlocks(seghdr); + CreateSpinlocks(); /* - * Set up shmem.c hashtable + * Set up shared memory allocation mechanism */ InitShmemAllocation(seghdr); /* + * Now initialize LWLocks, which do shared memory allocation and + * are needed for InitShmemIndex. + */ + CreateLWLocks(); + + /* + * Set up shmem.c index hashtable + */ + InitShmemIndex(); + + /* * Set up xlog, clog, and buffers */ XLOGShmemInit(); |
