From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: PostgreSQL Developers <pgsql-hackers@postgresql.org>
Subject: bug in SlabAlloc / VALGRIND_MAKE_MEM_DEFINED
Date: Tue, 4 Apr 2017 22:42:39 +0200
Message-ID: <a6543b6d-6015-99b1-63ef-3ed55a76a730@2ndquadrant.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Hi,
Andres nagged to me about valgrind runs taking much longer since
9fab40ad introduced the SlabContext into reorderbuffer.c. And by
"longer" I mean hours instead of minutes.
After a bit of investigation I stumbled on this line in slab.c:
VALGRIND_MAKE_MEM_DEFINED(chunk, SlabChunkGetPointer(chunk));
which is wrong, because the second parameter should be size and not
another pointer. This essentially marks a lot of memory as defined,
which results in the extreme test runtime.
Instead, the line should be:
VALGRIND_MAKE_MEM_DEFINED(SlabChunkGetPointer(chunk), sizeof(int32));
Patch attached.
--
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:
[binary/octet-stream] slab-valgrind-fix.patch (602B, ../a6543b6d-6015-99b1-63ef-3ed55a76a730@2ndquadrant.com/2-slab-valgrind-fix.patch)
download | inline diff:diff --git a/src/backend/utils/mmgr/slab.c b/src/backend/utils/mmgr/slab.cindex d6be4fe..a542017 100644--- a/src/backend/utils/mmgr/slab.c+++ b/src/backend/utils/mmgr/slab.c@@ -403,7 +403,7 @@ SlabAlloc(MemoryContext context, Size size)
* Remove the chunk from the freelist head. The index of the next free
* chunk is stored in the chunk itself.
*/
- VALGRIND_MAKE_MEM_DEFINED(chunk, SlabChunkGetPointer(chunk));+ VALGRIND_MAKE_MEM_DEFINED(SlabChunkGetPointer(chunk), sizeof(int32));
block->firstFreeChunk = *(int32 *) SlabChunkGetPointer(chunk);
Assert(block->firstFreeChunk >= 0);
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
Subject: Re: bug in SlabAlloc / VALGRIND_MAKE_MEM_DEFINED
In-Reply-To: <a6543b6d-6015-99b1-63ef-3ed55a76a730@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