diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c
index 36a04fc..72e774d 100644
--- a/src/backend/storage/ipc/ipci.c
+++ b/src/backend/storage/ipc/ipci.c
@@ -156,6 +156,7 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int port)
 		 * Create the shmem segment
 		 */
 		seghdr = PGSharedMemoryCreate(size, makePrivate, port, &shim);
+		elog(LOG, "shared memory size: %zu", size);
 
 		InitShmemAccess(seghdr);
 
@@ -269,4 +270,9 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int port)
 	 */
 	if (shmem_startup_hook)
 		shmem_startup_hook();
+
+	{
+		extern Size cachealignwaste;
+		elog(LOG, "total additional space consumed due to cache line alignment = %zu", cachealignwaste);
+	}
 }
diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c
index 81506ea..ea7412d 100644
--- a/src/backend/storage/ipc/shmem.c
+++ b/src/backend/storage/ipc/shmem.c
@@ -85,6 +85,7 @@ slock_t    *ShmemLock;			/* spinlock for shared memory and LWLock
 								 * allocation */
 
 static HTAB *ShmemIndex = NULL; /* primary index hashtable for shmem */
+Size cachealignwaste = 0;
 
 
 /*
@@ -173,7 +174,12 @@ ShmemAlloc(Size size)
 	/*
 	 * ensure all space is adequately aligned.
 	 */
-	size = MAXALIGN(size);
+	if (MAXALIGN(size) != CACHELINEALIGN(size))
+		elog(LOG, "size %zu -> maxalign %zu, cachelinealign %zu, delta %zu",
+			size, MAXALIGN(size), CACHELINEALIGN(size),
+			CACHELINEALIGN(size) - MAXALIGN(size));
+	cachealignwaste += CACHELINEALIGN(size) - MAXALIGN(size);
+	size = CACHELINEALIGN(size);
 
 	Assert(ShmemSegHdr != NULL);
 
