Index: src/backend/storage/ipc/shmem.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/storage/ipc/shmem.c,v retrieving revision 1.70 diff -u -r1.70 shmem.c --- src/backend/storage/ipc/shmem.c 4 Aug 2003 02:40:03 -0000 1.70 +++ src/backend/storage/ipc/shmem.c 21 Sep 2003 07:53:13 -0000 @@ -131,6 +131,7 @@ void * ShmemAlloc(Size size) { + uint32 newStart; uint32 newFree; void *newSpace; @@ -146,10 +147,14 @@ SpinLockAcquire(ShmemLock); - newFree = shmemseghdr->freeoffset + size; + newStart = shmemseghdr->freeoffset; + 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 Index: src/include/c.h =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/include/c.h,v retrieving revision 1.152 diff -u -r1.152 c.h --- src/include/c.h 4 Aug 2003 02:40:10 -0000 1.152 +++ src/include/c.h 21 Sep 2003 07:53:14 -0000 @@ -529,6 +529,7 @@ #define LONGALIGN(LEN) TYPEALIGN(ALIGNOF_LONG, (LEN)) #define DOUBLEALIGN(LEN) TYPEALIGN(ALIGNOF_DOUBLE, (LEN)) #define MAXALIGN(LEN) TYPEALIGN(MAXIMUM_ALIGNOF, (LEN)) +#define BUFFERALIGN(LEN) TYPEALIGN(ALIGNOF_BUFFER, (LEN)) /* ---------------------------------------------------------------- Index: src/include/pg_config_manual.h =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/include/pg_config_manual.h,v retrieving revision 1.5 diff -u -r1.5 pg_config_manual.h --- src/include/pg_config_manual.h 4 Aug 2003 00:43:29 -0000 1.5 +++ src/include/pg_config_manual.h 21 Sep 2003 07:53:14 -0000 @@ -176,6 +176,14 @@ */ #define MAX_RANDOM_VALUE (0x7FFFFFFF) +/* + * Alignment of the disk blocks in the shared memory area. + * A significant amount of the total system time is required for + * copying disk blocks between the os buffers and the cache in the + * shared memory area. Some cpus (most notably Intel Pentium III) + * prefer well-aligned addresses for memory copies. + */ +#define ALIGNOF_BUFFER 32 /* *------------------------------------------------------------------------