diff options
author | Robert Haas <rhaas@postgresql.org> | 2016-04-21 13:24:09 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2016-04-21 13:27:41 -0400 |
commit | 9f84280ae94b43b75dcf32aef433545335e7bb16 (patch) | |
tree | 558ba10db587c46c2e2917bd8fd88691558e6198 /src/backend/storage/buffer/buf_init.c | |
parent | 7cb1db1d9599f0a09d6920d2149d956ef6d88b0e (diff) | |
download | postgresql-9f84280ae94b43b75dcf32aef433545335e7bb16.tar.gz postgresql-9f84280ae94b43b75dcf32aef433545335e7bb16.zip |
Fix assorted defects in 09adc9a8c09c9640de05c7023b27fb83c761e91c.
That commit increased all shared memory allocations to the next higher
multiple of PG_CACHE_LINE_SIZE, but it didn't ensure that allocation
started on a cache line boundary. It also failed to remove a couple
other pieces of now-useless code.
BUFFERALIGN() is perhaps obsolete at this point, and likely should be
removed at some point, too, but that seems like it can be left to a
future cleanup.
Mistakes all pointed out by Andres Freund. The patch is mine, with
a few extra assertions which I adopted from his version of this fix.
Diffstat (limited to 'src/backend/storage/buffer/buf_init.c')
-rw-r--r-- | src/backend/storage/buffer/buf_init.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/backend/storage/buffer/buf_init.c b/src/backend/storage/buffer/buf_init.c index a5cffc78968..5804870ad48 100644 --- a/src/backend/storage/buffer/buf_init.c +++ b/src/backend/storage/buffer/buf_init.c @@ -76,11 +76,9 @@ InitBufferPool(void) /* Align descriptors to a cacheline boundary. */ BufferDescriptors = (BufferDescPadded *) - CACHELINEALIGN( - ShmemInitStruct("Buffer Descriptors", - NBuffers * sizeof(BufferDescPadded) - + PG_CACHE_LINE_SIZE, - &foundDescs)); + ShmemInitStruct("Buffer Descriptors", + NBuffers * sizeof(BufferDescPadded), + &foundDescs); BufferBlocks = (char *) ShmemInitStruct("Buffer Blocks", @@ -88,10 +86,9 @@ InitBufferPool(void) /* Align lwlocks to cacheline boundary */ BufferIOLWLockArray = (LWLockMinimallyPadded *) - CACHELINEALIGN(ShmemInitStruct("Buffer IO Locks", - NBuffers * (Size) sizeof(LWLockMinimallyPadded) - + PG_CACHE_LINE_SIZE, - &foundIOLocks)); + ShmemInitStruct("Buffer IO Locks", + NBuffers * (Size) sizeof(LWLockMinimallyPadded), + &foundIOLocks); BufferIOLWLockTranche.name = "buffer_io"; BufferIOLWLockTranche.array_base = BufferIOLWLockArray; |