On 2015-02-27 01:54:27 +0100, Andres Freund wrote:
> On 2015-02-26 19:28:50 -0500, Tom Lane wrote:
> > /*
> > *************** typedef struct MemoryContextData
> > *** 59,72 ****
> > MemoryContext firstchild; /* head of linked list of children */
> > MemoryContext nextchild; /* next child of same parent */
> > char *name; /* context name (just for debugging) */
> > bool isReset; /* T = no space alloced since last reset */
> > #ifdef USE_ASSERT_CHECKING
> > ! bool allowInCritSection; /* allow palloc in critical section */
> > #endif
> > } MemoryContextData;
>
> It's a bit sad to push AllocSetContextData onto four cachelines from the
> current three... That stuff is hot. But I don't really see a way around
> it right now. And it seems like it'd give us more amunition to improve
> things than the small loss of speed it implies.
Actually:
struct MemoryContextData { NodeTag type; /* 0 4 */
/* XXX 4 bytes hole, try to pack */
MemoryContextMethods * methods; /* 8 8 */ MemoryContext parent;
/* 16 8 */ MemoryContext firstchild; /* 24 8 */ MemoryContext
nextchild; /* 32 8 */ char * name; /* 40
8*/ bool isReset; /* 48 1 */ bool
allowInCritSection; /* 49 1 */
/* size: 56, cachelines: 1, members: 8 */ /* sum members: 46, holes: 1, sum holes: 4 */ /* padding:
6*/ /* last cacheline: 56 bytes */
};
If we move isReset and allowInCritSection after type, we'd stay at the
same size...
Andres Freund
-- Andres Freund http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services