Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cB4A7-0007CT-Qx for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Nov 2016 18:26:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cB4A7-0004UK-AV for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Nov 2016 18:26:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cB48i-0002x6-ED for pgsql-hackers@postgresql.org; Sun, 27 Nov 2016 18:25:24 +0000 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cB48e-0006yw-O3 for pgsql-hackers@postgresql.org; Sun, 27 Nov 2016 18:25:23 +0000 Received: by mail-wm0-x231.google.com with SMTP id a197so185992357wmd.0 for ; Sun, 27 Nov 2016 10:25:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=ydFcGnghiOeOm5malrwmhaHpzHEVhE3IHJ6BLIe4pJI=; b=ndcw3S8tKVgDFqxVFiifMAAlE0Ng8qbscmnCT82fmv8K6FmWvCLjj+VnIkOBWTNb98 Kz87RCZdtYUdQXWCtsWH+VJ5preAMzH1kxtQlXQ/XYUa9i1BA2dULZ9jPUFbtk52di85 G2IsHWq1zS7kq8UFjX0ZphX0BXP3s+r0IXyoh1tJqTcO/1vHJBsLxXtA/oYo6rZdB4vW VdYuRULvmGRjZyGsNIyoi2/ogC0eHgfstKkWM53l839x2OISp4iV+/nUb4y35w+dwHgK AdZEvPRyL7wdqqCSxggO1Oh8ct4A42msGrRIHFSmKj4uQsJkCZ3HL+nmGC7BiwQEGTU1 dasw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=ydFcGnghiOeOm5malrwmhaHpzHEVhE3IHJ6BLIe4pJI=; b=LVkoidrZj0fRZQEE0GWCL/mzMzbBko1RvxbWH9lWW6IVQPX5xQEfOTrcfcCoutJ411 0cwP8a33STb3uQXP9pW53cyyVi+64YdVSZLKUO4/MruUtlpLXP2jtM3kMdjkgRyFgBGE pCRrxvzAyYnlzWeg/YXXYYIwulaorn01Czs2tLhtoO4tf3KQvBjhhcjuK1Dpa0pyeUkj ylI4tH0G2XGSlzDXnPcZ6c0y2MkvsNgTdMHtByINSSHlmMwVdBSLeJtSnc+iX4Esx+/s fieZ3lDUvhbqOz2V3Seo5vZUjhODy2Y7EnRWDJD7LkcFUsapjs+l1fDlTL7F/lIQTs+8 Zs7A== X-Gm-Message-State: AKaTC03f46guZdobA85Mui94Gqi0oDnkT9i5ro9j1YSIB3ZclPsuuXsOEbQEgtZeV+IcKvjl92fH3BWeqDUnFP0478+vlGunkHfIDYaoKOEHxh9eGb/nhpajq85Y8r77zDKzDrASZjqyjcsKEPcbdo70WXJVHGpezKOmPecK+RueAVOJUg816e4U54w8OdLPeQ== X-Received: by 10.28.54.97 with SMTP id d94mr17044857wma.28.1480271118563; Sun, 27 Nov 2016 10:25:18 -0800 (PST) Received: from [192.168.0.105] (150.123.broadband11.iol.cz. [90.178.123.150]) by smtp.gmail.com with ESMTPSA id 81sm24727090wmw.7.2016.11.27.10.25.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Nov 2016 10:25:17 -0800 (PST) Subject: Re: PATCH: two slab-like memory allocators To: Tomas Vondra , Andres Freund References: <11821eb9-95a5-353e-ccba-13e8e9351e62@2ndquadrant.com> <9818b54a-fcb6-f018-0b16-96d6a1d1da27@2ndquadrant.com> <34a6d4ea-7f3d-a62c-fff1-7a9108c078d7@2ndquadrant.com> <4f176a6c-c197-165d-dee4-5de8f279f1f4@2ndquadrant.com> <20161112191257.3a4n6kzegvu637qn@alap3.anarazel.de> <0b14e90b-1985-bb04-0261-2fcdc28755ab@2ndquadrant.com> Cc: Robert Haas , John Gorman , pgsql-hackers From: Petr Jelinek Message-ID: <9cdbe694-1b49-0c61-b0b2-d95ef2b3cb31@2ndquadrant.com> Date: Sun, 27 Nov 2016 19:25:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <0b14e90b-1985-bb04-0261-2fcdc28755ab@2ndquadrant.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.6 (--) 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 On 15/11/16 01:44, Tomas Vondra wrote: > 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. I think Andres wanted to put the implementation to the static inline functions directly in the header (see parts of pg_list or how atomics work), but I guess you way works too. > > 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. > +1 I get mxact isolation test failures in test_decoding with this version of patch: step s0w: INSERT INTO do_write DEFAULT VALUES; + WARNING: problem in slab TXN: number of free chunks 33 in block 0x22beba0 does not match bitmap 34 step s0start: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', 'false'); data and step s0alter: ALTER TABLE do_write ADD column ts timestamptz; step s0w: INSERT INTO do_write DEFAULT VALUES; + WARNING: problem in slab TXN: number of free chunks 33 in block 0x227c3f0 does not match bitmap 34 step s0start: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', 'false'); data Also, let's just rename the Gen to Generation. -- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers