aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/lmgr/lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage/lmgr/lock.c')
-rw-r--r--src/backend/storage/lmgr/lock.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index 9699469e6d3..e53415cc5f8 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.141 2004/09/28 20:46:32 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.142 2004/09/29 15:15:55 tgl Exp $
*
* NOTES
* Outside modules can create a lock table and acquire/release
@@ -1689,15 +1689,17 @@ LockReassignCurrentOwner(void)
}
+/*
+ * Estimate shared-memory space used for lock tables
+ */
int
LockShmemSize(int maxBackends)
{
int size = 0;
long max_table_size = NLOCKENTS(maxBackends);
- size += MAXALIGN(sizeof(PROC_HDR)); /* ProcGlobal */
- size += maxBackends * MAXALIGN(sizeof(PGPROC)); /* each MyProc */
- size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LockMethodData)); /* each lock method */
+ /* lock method headers */
+ size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LockMethodData));
/* lockHash table */
size += hash_estimate_size(max_table_size, sizeof(LOCK));
@@ -1706,6 +1708,9 @@ LockShmemSize(int maxBackends)
size += hash_estimate_size(max_table_size, sizeof(PROCLOCK));
/*
+ * Note we count only one pair of hash tables, since the userlocks
+ * table actually overlays the main one.
+ *
* Since the lockHash entry count above is only an estimate, add 10%
* safety margin.
*/