Re: [HACKERS] PATCH: two slab-like memory allocators

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] PATCH: two slab-like memory allocators
Дата
Msg-id 1240.1488254244@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] PATCH: two slab-like memory allocators  (Andres Freund <andres@anarazel.de>)
Ответы Re: [HACKERS] PATCH: two slab-like memory allocators  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> Independently of this, we really should redefine StandardChunkHeader to
> be only the MemoryContext.  There's no need to have size/requested_size
> part of StandardChunkHeader, given there's
> MemoryContextMethods->get_chunk_space().

Yeah, perhaps.  The trick would be to get things laid out so that the 
MemoryContext pointer is always immediately adjacent to the chunk data
(no padding between).

One could imagine redefining aset.c's chunk header along the lines of

typedef struct AllocSetChunkHeader
{   Size        size;             /* size of data space allocated in chunk */
#ifdef MEMORY_CONTEXT_CHECKING   Size        requested_size;   /* original request size */
#if 32-bit-but-maxalign-is-8   Size        padding;          /* needed to avoid padding below */
#endif
#endif   MemoryContext context;        /* owning context */   /* there must not be any padding to reach a MAXALIGN
boundaryhere! */
 
} AllocSetChunkHeader;

where we'd possibly need some help from configure to implement that inner
#if condition, but it seems doable enough.

If the slab allocator would be happier with just a MemoryContext pointer
as chunk header, I think we should push in this direction rather than
invent some short-term hack.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Petr Jelinek
Дата:
Сообщение: Re: [HACKERS] logical replication access control patches
Следующее
От: Amit Langote
Дата:
Сообщение: Re: [HACKERS] Partitioned tables and relfilenode