Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cvVJR-0006ZG-4r for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Apr 2017 20:44:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cvVJQ-0007KX-Ix for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Apr 2017 20:44:24 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cvVHv-0004gR-Jm for pgsql-hackers@postgresql.org; Tue, 04 Apr 2017 20:42:51 +0000 Received: from mail-wr0-x231.google.com ([2a00:1450:400c:c0c::231]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cvVHo-0000x5-Pm for pgsql-hackers@postgresql.org; Tue, 04 Apr 2017 20:42:50 +0000 Received: by mail-wr0-x231.google.com with SMTP id t20so19227063wra.1 for ; Tue, 04 Apr 2017 13:42:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version; bh=1wGoMrJA7lGO3u5sG1erDFgRv6OF610ZNq1TWgBMJD4=; b=etOoAll/EvT2Sns1CSgIbAE/d6rHU8MvkbTk4cw4yf0LbL8yUbpKdjBaG1Ccm12mbh BV4WkHggAqOEq+ZsNCttkQQM54HJiRr9Ii1TohMPLVaPiQJYRur5BZPdpfwvmmx/mqDC TIaq9FT9goRk1U0VfvafUWnLF8SU9LBIJsOHVuno8dler/5Fhm7iZQJMjGbERJeQ7gFq igdiVg91zdJzbnsi1gTs7zfWgDPt95Ur7IOo4hhlYiC72yZzM3Y15x4obsKKgLlOlXRI CJ4D+g7rcQGMdZOLDrnTsMcVvmsFIZnPhpaXjdKJyTzFr/nTH4Xz7TAoit/U5a80j6rO bgJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version; bh=1wGoMrJA7lGO3u5sG1erDFgRv6OF610ZNq1TWgBMJD4=; b=ZytIGhM+B7fF7tkD6us8fzLN/vcqtV9zSO66bzliJftTcFiJpy9oXOLQeFpKGxt0+I +SPHGwhAWCu+0IpvpftW4S8O1bb6EFwkn/RIH18DxVBOEAhvjf7J+1/hBXzq2BrKAsHU 0FR7eviu8lMBp78DgUl6cbFEeusbsoqaQfcXhlJrx5ib4TzqW32DBUFbwgaP91UgAhUS L+Cx3RRSnqUYvzAofad6ExqF3uaA/RAvGejDf1ktKDSH6o84458YAGuvWNvOcey2VnPE Tc/TwL88bACYybJ1EH2kLzQg+K0+GMNkwdkAntIuDsoa3Wv3vTxc6jTHpcUXZjt0hZGS cNew== X-Gm-Message-State: AFeK/H3WcS7KuLL09kdcDJC6SSA3PGWduKQTMl4RCF4otnVViw3p0DtdUKGlhIzdovCUsdNhAMCRBQWQ1rNRAwT45i4S9J/sVsxEbezgt75P1+M8ddi8XT5P4Q//vxXHZFbfFQ4wijpkURFm9Ri4BG21LpLFp/DPkCLoOjdmzX9cJ4/IrtbBMfckVwnsExnYxPK9D8URGg2A X-Received: by 10.223.176.11 with SMTP id f11mr3993938wra.158.1491338561921; Tue, 04 Apr 2017 13:42:41 -0700 (PDT) Received: from [10.137.2.17] (ip-89-177-46-65.net.upcbroadband.cz. [89.177.46.65]) by smtp.gmail.com with ESMTPSA id l41sm23654838wrl.59.2017.04.04.13.42.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Apr 2017 13:42:41 -0700 (PDT) To: PostgreSQL Developers From: Tomas Vondra Subject: bug in SlabAlloc / VALGRIND_MAKE_MEM_DEFINED Message-ID: Date: Tue, 4 Apr 2017 22:42:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------430990368B67457DF8C83CB0" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is a multi-part message in MIME format. --------------430990368B67457DF8C83CB0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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 --------------430990368B67457DF8C83CB0 Content-Type: binary/octet-stream; name="slab-valgrind-fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="slab-valgrind-fix.patch" diff --git a/src/backend/utils/mmgr/slab.c b/src/backend/utils/mmgr/slab.c index 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); --------------430990368B67457DF8C83CB0 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --------------430990368B67457DF8C83CB0--