pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Petr Jelinek <petr.jelinek@2ndquadrant.com>
Cc: Petr Jelinek <petr@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: John Gorman <johngorman2@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: PATCH: two slab-like memory allocators
Date: Mon, 27 Feb 2017 21:16:30 -0800
Message-ID: <20170228051630.3qcevakcaaa6b4ef@alap3.anarazel.de> (raw)
In-Reply-To: <1240.1488254244@sss.pgh.pa.us>
References: <20170227111732.vrx5v72ighehwpkf@alap3.anarazel.de>
	<20170227120200.5jc3ubg5jrqaznd7@alap3.anarazel.de>
	<26061.1488209545@sss.pgh.pa.us>
	<20170227155532.o7casczq5parlmz4@alap3.anarazel.de>
	<20170227164828.akgzeg6ggl2v4x7s@alap3.anarazel.de>
	<12622.1488216468@sss.pgh.pa.us>
	<20170227174201.yrofai7neyp6shb2@alap3.anarazel.de>
	<c7c1bb85-d1d0-05a5-4d4c-3047d6f053e7@2ndquadrant.com>
	<20170228034232.4h7ouyhxq4lbbao2@alap3.anarazel.de>
	<1240.1488254244@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Hi,

On 2017-02-27 22:57:24 -0500, Tom Lane wrote:
> 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.

It would - it really doesn't need the size, because it's the same for
the whole context, and thereby is a waste of space.  Still wondering if
we should band-aid this till that's done.


> 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 boundary here! */
> } AllocSetChunkHeader;
> 
> where we'd possibly need some help from configure to implement that inner
> #if condition, but it seems doable enough.

Hm, that should be doable with something like
#if MAXIMUM_ALIGNOF > 4 && SIZEOF_VOID_P == 4

which'd probably be better documentation than a macro that hides this
(arguing internally whether SIZEOF_VOID_P or SIZEOF_SIZE_T) is better.

Working on a patch now, will post but not push tonight.

Greetings,

Andres Freund


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (97+ messages)  latest in thread

Message-ID: <20170228051630.3qcevakcaaa6b4ef@alap3.anarazel.de>
Permalink:  ../20170228051630.3qcevakcaaa6b4ef@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20170228051630.3qcevakcaaa6b4ef@alap3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: andres@anarazel.de, tgl@sss.pgh.pa.us, tomas.vondra@2ndquadrant.com, petr.jelinek@2ndquadrant.com, petr@2ndquadrant.com, robertmhaas@gmail.com, johngorman2@gmail.com
  Subject: Re: PATCH: two slab-like memory allocators
  In-Reply-To: <20170228051630.3qcevakcaaa6b4ef@alap3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox