diff --git a/src/backend/utils/mmgr/generation.c b/src/backend/utils/mmgr/generation.c
index e530e272e0..8ac2144ddd 100644
--- a/src/backend/utils/mmgr/generation.c
+++ b/src/backend/utils/mmgr/generation.c
@@ -89,7 +89,6 @@ typedef struct GenerationContext
 struct GenerationBlock
 {
 	dlist_node	node;			/* doubly-linked list of blocks */
-	Size		blksize;		/* allocated size of this block */
 	int			nchunks;		/* number of chunks in the block */
 	int			nfree;			/* number of free chunks */
 	char	   *freeptr;		/* start of free space in this block */
@@ -117,9 +116,9 @@ struct GenerationChunk
 	/* this is zero in a free chunk */
 	Size		requested_size;
 
-#define GENERATIONCHUNK_RAWSIZE  (SIZEOF_SIZE_T * 2 + SIZEOF_VOID_P * 2)
+#define GENERATIONCHUNK_RAWSIZE  (SIZEOF_SIZE_T * 2 + SIZEOF_VOID_P)
 #else
-#define GENERATIONCHUNK_RAWSIZE  (SIZEOF_SIZE_T + SIZEOF_VOID_P * 2)
+#define GENERATIONCHUNK_RAWSIZE  (SIZEOF_SIZE_T + SIZEOF_VOID_P)
 #endif							/* MEMORY_CONTEXT_CHECKING */
 
 	/* ensure proper alignment by adding padding if needed */
@@ -127,7 +126,6 @@ struct GenerationChunk
 	char		padding[MAXIMUM_ALIGNOF - GENERATIONCHUNK_RAWSIZE % MAXIMUM_ALIGNOF];
 #endif
 
-	GenerationBlock *block;		/* block owning this chunk */
 	GenerationContext *context; /* owning context, or NULL if freed chunk */
 	/* there must not be any padding to reach a MAXALIGN boundary here! */
 };
@@ -258,7 +256,7 @@ GenerationContextCreate(MemoryContext parent,
 	 * starts with the context header and its block header follows that.
 	 */
 	set = (GenerationContext *) malloc(allocSize);
-	if (set == NULL)
+	if (unlikely(set == NULL))
 	{
 		MemoryContextStats(TopMemoryContext);
 		ereport(ERROR,
@@ -276,12 +274,15 @@ GenerationContextCreate(MemoryContext parent,
 
 	/* Fill in the initial block's block header */
 	block = (GenerationBlock *) (((char *) set) + MAXALIGN(sizeof(GenerationContext)));
+
 	/* determine the block size and initialize it */
 	firstBlockSize = allocSize - MAXALIGN(sizeof(GenerationContext));
 	GenerationBlockInit(block, firstBlockSize);
 
-	/* add it to the doubly-linked list of blocks */
-	dlist_push_head(&set->blocks, &block->node);
+	/* Fill in GenerationContext-specific header fields */
+	set->initBlockSize = initBlockSize;
+	set->maxBlockSize = maxBlockSize;
+	set->nextBlockSize = initBlockSize;
 
 	/* use it as the current allocation block */
 	set->block = block;
@@ -292,10 +293,8 @@ GenerationContextCreate(MemoryContext parent,
 	/* Mark block as not to be released at reset time */
 	set->keeper = block;
 
-	/* Fill in GenerationContext-specific header fields */
-	set->initBlockSize = initBlockSize;
-	set->maxBlockSize = maxBlockSize;
-	set->nextBlockSize = initBlockSize;
+	/* add it to the doubly-linked list of blocks */
+	dlist_push_head(&set->blocks, &block->node);
 
 	/*
 	 * Compute the allocation chunk size limit for this context.
@@ -356,12 +355,12 @@ GenerationReset(MemoryContext context)
 			GenerationBlockFree(set, block);
 	}
 
-	/* set it so new allocations to make use of the keeper block */
-	set->block = set->keeper;
-
 	/* Reset block size allocation sequence, too */
 	set->nextBlockSize = set->initBlockSize;
 
+	/* set it so new allocations to make use of the keeper block */
+	set->block = set->keeper;
+
 	/* Ensure there is only 1 item in the dlist */
 	Assert(!dlist_is_empty(&set->blocks));
 	Assert(!dlist_has_next(&set->blocks, dlist_head_node(&set->blocks)));
@@ -408,23 +407,22 @@ GenerationAlloc(MemoryContext context, Size size)
 		Size		blksize = required_size + Generation_BLOCKHDRSZ;
 
 		block = (GenerationBlock *) malloc(blksize);
-		if (block == NULL)
+		if (unlikely(block == NULL))
 			return NULL;
 
-		context->mem_allocated += blksize;
-
 		/* block with a single (used) chunk */
-		block->blksize = blksize;
 		block->nchunks = 1;
 		block->nfree = 0;
 
 		/* the block is completely full */
 		block->freeptr = block->endptr = ((char *) block) + blksize;
 
+		/* add the block to the list of allocated blocks */
+		dlist_push_head(&set->blocks, &block->node);
+
 		chunk = (GenerationChunk *) (((char *) block) + Generation_BLOCKHDRSZ);
-		chunk->block = block;
-		chunk->context = set;
 		chunk->size = chunk_size;
+		chunk->context = set;
 
 #ifdef MEMORY_CONTEXT_CHECKING
 		chunk->requested_size = size;
@@ -437,8 +435,7 @@ GenerationAlloc(MemoryContext context, Size size)
 		randomize_mem((char *) GenerationChunkGetPointer(chunk), size);
 #endif
 
-		/* add the block to the list of allocated blocks */
-		dlist_push_head(&set->blocks, &block->node);
+		context->mem_allocated += blksize;
 
 		/* Ensure any padding bytes are marked NOACCESS. */
 		VALGRIND_MAKE_MEM_NOACCESS((char *) GenerationChunkGetPointer(chunk) + size,
@@ -470,7 +467,6 @@ GenerationAlloc(MemoryContext context, Size size)
 	if (block == NULL ||
 		GenerationBlockFreeBytes(block) < required_size)
 	{
-		Size		blksize;
 		GenerationBlock *freeblock = set->freeblock;
 
 		if (freeblock != NULL &&
@@ -492,6 +488,8 @@ GenerationAlloc(MemoryContext context, Size size)
 		}
 		else
 		{
+			Size		blksize;
+
 			/*
 			 * The first such block has size initBlockSize, and we double the
 			 * space in each succeeding block, but not more than maxBlockSize.
@@ -510,17 +508,17 @@ GenerationAlloc(MemoryContext context, Size size)
 
 			block = (GenerationBlock *) malloc(blksize);
 
-			if (block == NULL)
+			if (unlikely(block == NULL))
 				return NULL;
 
-			context->mem_allocated += blksize;
-
 			/* initialize the new block */
 			GenerationBlockInit(block, blksize);
 
 			/* add it to the doubly-linked list of blocks */
 			dlist_push_head(&set->blocks, &block->node);
 
+			context->mem_allocated += blksize;
+
 			/* Zero out the freeblock in case it's become full */
 			set->freeblock = NULL;
 		}
@@ -543,9 +541,8 @@ GenerationAlloc(MemoryContext context, Size size)
 
 	Assert(block->freeptr <= block->endptr);
 
-	chunk->block = block;
-	chunk->context = set;
 	chunk->size = chunk_size;
+	chunk->context = set;
 
 #ifdef MEMORY_CONTEXT_CHECKING
 	chunk->requested_size = size;
@@ -576,7 +573,6 @@ GenerationAlloc(MemoryContext context, Size size)
 static inline void
 GenerationBlockInit(GenerationBlock *block, Size blksize)
 {
-	block->blksize = blksize;
 	block->nchunks = 0;
 	block->nfree = 0;
 
@@ -647,10 +643,10 @@ GenerationBlockFree(GenerationContext *set, GenerationBlock *block)
 	/* release the block from the list of blocks */
 	dlist_delete(&block->node);
 
-	((MemoryContext) set)->mem_allocated -= block->blksize;
+	((MemoryContext) set)->mem_allocated -= block->endptr - ((char *) block);
 
 #ifdef CLOBBER_FREED_MEMORY
-	wipe_mem(block, block->blksize);
+	wipe_mem(block, block->endptr - ((char *) block));
 #endif
 
 	free(block);
@@ -671,8 +667,6 @@ GenerationFree(MemoryContext context, void *pointer)
 	/* Allow access to private part of chunk header. */
 	VALGRIND_MAKE_MEM_DEFINED(chunk, GENERATIONCHUNK_PRIVATE_LEN);
 
-	block = chunk->block;
-
 #ifdef MEMORY_CONTEXT_CHECKING
 	/* Test for someone scribbling on unused space in chunk */
 	if (chunk->requested_size < chunk->size)
@@ -693,6 +687,7 @@ GenerationFree(MemoryContext context, void *pointer)
 	chunk->requested_size = 0;
 #endif
 
+	block = (GenerationBlock *) (((char *) pointer) - Generation_BLOCKHDRSZ);
 	block->nfree += 1;
 
 	Assert(block->nchunks > 0);
@@ -732,7 +727,7 @@ GenerationFree(MemoryContext context, void *pointer)
 	 */
 	dlist_delete(&block->node);
 
-	context->mem_allocated -= block->blksize;
+	context->mem_allocated -= block->endptr - ((char *) block);
 	free(block);
 }
 
@@ -822,7 +817,7 @@ GenerationRealloc(MemoryContext context, void *pointer, Size size)
 	newPointer = GenerationAlloc((MemoryContext) set, size);
 
 	/* leave immediately if request was not completed */
-	if (newPointer == NULL)
+	if (unlikely(newPointer == NULL))
 	{
 		/* Disallow external access to private part of chunk header. */
 		VALGRIND_MAKE_MEM_NOACCESS(chunk, GENERATIONCHUNK_PRIVATE_LEN);
@@ -926,7 +921,7 @@ GenerationStats(MemoryContext context,
 		nblocks++;
 		nchunks += block->nchunks;
 		nfreechunks += block->nfree;
-		totalspace += block->blksize;
+		totalspace += block->endptr - ((char *) block);
 		freespace += (block->endptr - block->freeptr);
 	}
 
@@ -977,7 +972,7 @@ GenerationCheck(MemoryContext context)
 					nchunks;
 		char	   *ptr;
 
-		total_allocated += block->blksize;
+		total_allocated += block->endptr - ((char *) block);
 
 		/*
 		 * nfree > nchunks is surely wrong.  Equality is allowed as the block
@@ -1004,11 +999,6 @@ GenerationCheck(MemoryContext context)
 
 			nchunks += 1;
 
-			/* chunks have both block and context pointers, so check both */
-			if (chunk->block != block)
-				elog(WARNING, "problem in Generation %s: bogus block link in block %p, chunk %p",
-					 name, block, chunk);
-
 			/*
 			 * Check for valid context pointer.  Note this is an incomplete
 			 * test, since palloc(0) produces an allocated chunk with
