1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-31 17:02:12 +03:00

Arrange to align shared disk buffers on at least 32-byte boundaries,

not just MAXALIGN boundaries.  This makes a noticeable difference in
the speed of transfers to and from kernel space, at least on recent
Pentiums, and might help other CPUs too.  We should look at making
this happen for local buffers and buffile.c too.  Patch from Manfred Spraul.
This commit is contained in:
Tom Lane
2003-09-21 17:57:21 +00:00
parent 11b274f00f
commit 5aa29e88e9
3 changed files with 24 additions and 6 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.70 2003/08/04 02:40:03 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.71 2003/09/21 17:57:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -131,6 +131,7 @@ InitShmemAllocation(void *seghdr)
void *
ShmemAlloc(Size size)
{
uint32 newStart;
uint32 newFree;
void *newSpace;
@@ -146,10 +147,16 @@ ShmemAlloc(Size size)
SpinLockAcquire(ShmemLock);
newFree = shmemseghdr->freeoffset + size;
newStart = shmemseghdr->freeoffset;
/* extra alignment for large requests, since they are probably buffers */
if (size >= BLCKSZ)
newStart = BUFFERALIGN(newStart);
newFree = newStart + size;
if (newFree <= shmemseghdr->totalsize)
{
newSpace = (void *) MAKE_PTR(shmemseghdr->freeoffset);
newSpace = (void *) MAKE_PTR(newStart);
shmemseghdr->freeoffset = newFree;
}
else