summaryrefslogtreecommitdiff
path: root/contrib/pg_buffercache/pg_buffercache_pages.c
diff options
context:
space:
mode:
authorRobert Haas2014-01-27 16:07:44 +0000
committerRobert Haas2014-01-27 16:07:44 +0000
commitea9df812d8502fff74e7bc37d61bdc7d66d77a7f (patch)
tree7e138cbe713ccbf24c3be5603bcc84cae1f3079e /contrib/pg_buffercache/pg_buffercache_pages.c
parentf62eba204f367acbfea7e63991524bf981b307f8 (diff)
Relax the requirement that all lwlocks be stored in a single array.
This makes it possible to store lwlocks as part of some other data structure in the main shared memory segment, or in a dynamic shared memory segment. There is still a main LWLock array and this patch does not move anything out of it, but it provides necessary infrastructure for doing that in the future. This change is likely to increase the size of LWLockPadded on some platforms, especially 32-bit platforms where it was previously only 16 bytes. Patch by me. Review by Andres Freund and KaiGai Kohei.
Diffstat (limited to 'contrib/pg_buffercache/pg_buffercache_pages.c')
-rw-r--r--contrib/pg_buffercache/pg_buffercache_pages.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/pg_buffercache/pg_buffercache_pages.c b/contrib/pg_buffercache/pg_buffercache_pages.c
index dbf8030f7c6..1e2d192f119 100644
--- a/contrib/pg_buffercache/pg_buffercache_pages.c
+++ b/contrib/pg_buffercache/pg_buffercache_pages.c
@@ -116,7 +116,7 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
* possible deadlocks.
*/
for (i = 0; i < NUM_BUFFER_PARTITIONS; i++)
- LWLockAcquire(FirstBufMappingLock + i, LW_SHARED);
+ LWLockAcquire(BufMappingPartitionLockByIndex(i), LW_SHARED);
/*
* Scan though all the buffers, saving the relevant fields in the
@@ -157,7 +157,7 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
* avoids O(N^2) behavior inside LWLockRelease.
*/
for (i = NUM_BUFFER_PARTITIONS; --i >= 0;)
- LWLockRelease(FirstBufMappingLock + i);
+ LWLockRelease(BufMappingPartitionLockByIndex(i));
}
funcctx = SRF_PERCALL_SETUP();