diff options
author | Robert Haas | 2015-12-29 01:08:48 +0000 |
---|---|---|
committer | Robert Haas | 2015-12-29 01:08:48 +0000 |
commit | 9af39d7d7ee7e1b857579710b41891195bf9eabe (patch) | |
tree | 7c0062661309bc1d47e34e5a5f850af4e2d81932 | |
parent | b8c1216acd502295f3b9a3636020d37d66968deb (diff) |
Hacking.aset_changes
-rw-r--r-- | src/backend/utils/mmgr/aset.c | 21 | ||||
-rw-r--r-- | src/include/utils/memutils.h | 10 |
2 files changed, 13 insertions, 18 deletions
diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c index e13072849d..962eea350a 100644 --- a/src/backend/utils/mmgr/aset.c +++ b/src/backend/utils/mmgr/aset.c @@ -181,7 +181,7 @@ typedef struct AllocSetContext Size maxBlockSize; /* maximum block size */ Size nextBlockSize; /* next block size to allocate */ Size allocChunkLimit; /* effective chunk size limit */ - AllocBlock keeper; /* if not NULL, keep this block over resets */ + AllocBlock keeper; /* keep this block over resets */ } AllocSetContext; typedef AllocSetContext *AllocSet; @@ -210,19 +210,16 @@ typedef struct AllocBlockData * AllocChunk * The prefix of each piece of memory in an AllocBlock * - * NB: this MUST match StandardChunkHeader as defined by utils/memutils.h. + * NB: The last element of this structure MUST be a StandardChunkHeader. */ typedef struct AllocChunkData { - /* aset is the owning aset if allocated, or the freelist link if free */ - void *aset; - /* size is always the size of the usable space in the chunk */ - Size size; #ifdef MEMORY_CONTEXT_CHECKING /* when debugging memory usage, also store actual requested size */ /* this is zero in a free chunk */ Size requested_size; #endif + StandardChunkHeader standard_header; } AllocChunkData; /* @@ -283,13 +280,11 @@ static const unsigned char LogTable256[256] = }; /* - * Whenever we allocate an AllocSetContext, we pad it out to 2kB and use + * Whenever we allocate an AllocSetContext, we pad it out to 1kB and use * the space not required by the context itself to store the context name - * and the first few allocations. (The AllocSetContext structure itself - * is ~200 bytes, so making this only 1kB would leave barely any room for - * actual allocations.) + * and the first few allocations. */ -#define ALLOCSET_PADDED_SIZE 2048 +#define ALLOCSET_PADDED_SIZE 1024 typedef union AllocSetContextPadded { AllocSetContext context; @@ -487,7 +482,7 @@ AllocSetContextCreate(MemoryContext parent, else if (AllocSetFreelist != NULL) { /* - * An ordinary AllocSetPadded is adequate for our purposes, and + * An ordinary AllocSetContextPadded is adequate for our purposes, and * there's one available on the freelist. Pop it off and use it! * This is expected to be the normal case. */ @@ -501,7 +496,7 @@ AllocSetContextCreate(MemoryContext parent, int i; /* - * An ordinary AllocSetPadded is adequate for our purposes, but + * An ordinary AllocSetContextPadded is adequate for our purposes, but * there aren't any on the freelist. Allocate space for a bunch * more contexts, put all but the first one on the freelist, and * use the first one. This will happen when creating diff --git a/src/include/utils/memutils.h b/src/include/utils/memutils.h index 4d105793d9..597ffc9b56 100644 --- a/src/include/utils/memutils.h +++ b/src/include/utils/memutils.h @@ -68,9 +68,9 @@ * On systems with 8-byte alignment, we allow 29 bits for the context ID and * 32 bits for the size. This allows for up to half a billion context IDs and * sizes of up to 1 byte less than 4GB. Thus, extended headers should - * almost never be required. On systems with 4-byte alignment, we allow 11 - * bits for the context ID and 18 bits for the size, which allows for up to - * 2048 possible context IDs and allocations of up to 1 byte less than 256kB. + * almost never be required. On systems with 4-byte alignment, we allow 20 + * bits for the context ID and 19 bits for the size, which allows for up to + * 1 million possible context IDs and allocations of up to 511 bytes. * This should be good enough that most allocations won't need an extended * header, but some will. */ @@ -81,8 +81,8 @@ typedef uint64 chunk_unsigned; #define CHUNK_SIZE_BITS 32 #else typedef uint32 chunk_unsigned; -#define CHUNK_CONTEXT_ID_BITS 11 -#define CHUNK_SIZE_BITS 18 +#define CHUNK_CONTEXT_ID_BITS 20 +#define CHUNK_SIZE_BITS 9 #endif /* Context type codes; must be less than 1 << CHUNK_CONTEXT_TYPE_BITS. */ |