From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
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: Tue, 15 Nov 2016 01:44:35 +0100
Message-ID: <0b14e90b-1985-bb04-0261-2fcdc28755ab@2ndquadrant.com> (raw)
In-Reply-To: <efd47210-cf95-d7ee-e984-a873f76596a8@2ndquadrant.com>
References: <CALkS6B8hisTEJJ7ZCQ_GiBLNVzKfsevAD+92rYN6myyFK=UQtw@mail.gmail.com>
<11821eb9-95a5-353e-ccba-13e8e9351e62@2ndquadrant.com>
<b8ded0aa-2515-7ffd-162b-8f515df5eca1@2ndquadrant.com>
<CA+Tgmob7u4thiBbdvyseQk1aVApJeG10C_rFFt8LPV03-UzD7g@mail.gmail.com>
<a4593432-c989-8ec4-2320-943e3f97ce6d@2ndquadrant.com>
<CA+TgmobJrM74FRTcmn2JDMVbLB0a5pj5e3ieLBMzkDNtrxF4dw@mail.gmail.com>
<9818b54a-fcb6-f018-0b16-96d6a1d1da27@2ndquadrant.com>
<34a6d4ea-7f3d-a62c-fff1-7a9108c078d7@2ndquadrant.com>
<f2aaf4a5-412c-a4b9-389d-c9f682fbdc77@2ndquadrant.com>
<4f176a6c-c197-165d-dee4-5de8f279f1f4@2ndquadrant.com>
<20161112191257.3a4n6kzegvu637qn@alap3.anarazel.de>
<efd47210-cf95-d7ee-e984-a873f76596a8@2ndquadrant.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Attached is v6 of the patch series, fixing most of the points:
* common bits (valgrind/randomization/wipe) moved to memdebug.h/c
Instead of introducing a new header file, I've added the prototypes to
memdebug.h (which was already used for the valgrind stuff anyway), and
the implementations to a new memdebug.c file. Not sure what you meant by
"static inlines" though.
So the patch series now has three parts - 0001 with memdebug stuff, 0002
with slab and 0003 with gen (still a poor name).
* removing AllocSet references from both new memory contexts
* using FLEXIBLE_ARRAY_ELEMENT in SlabContext
* using dlist instead of the custom linked list
I've however kept SlabContext->freelist as an array, because there may
be many blocks with the same number of free chunks, in which case moving
the block in the list would be expensive. This way it's simply
dlist_delete + dlist_push.
* use StandardChunkHeader instead of the common fields
* removing pointer to context from block header for both contexts
* fix format in FreeInfo/AllocInfo (including for AllocSet)
* improved a bunch of comments (bitmap size, chunksPerBlock formula)
* did a pgindent run on the patch
* implement the missing methods in Gen (Stats/Check)
* fix a few minor bugs in both contexts
I haven't done anything with hiding pointers behind typedefs, because I
don't know what's so wrong about that.
I also haven't done anything with the bitmap access in SlabAlloc - I
haven't found any reasonable case when it would be measurable, and I
don't expect this to be even measurable in practice.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackersAttachments:
[application/x-compressed-tar] slab-allocators-v6.tgz (18.2K, ../0b14e90b-1985-bb04-0261-2fcdc28755ab@2ndquadrant.com/2-slab-allocators-v6.tgz)
download
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: tomas.vondra@2ndquadrant.com, andres@anarazel.de, petr@2ndquadrant.com, robertmhaas@gmail.com, johngorman2@gmail.com
Subject: Re: PATCH: two slab-like memory allocators
In-Reply-To: <0b14e90b-1985-bb04-0261-2fcdc28755ab@2ndquadrant.com>
* 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