Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eI0Kz-0006xG-Tj for pgsql-committers@arkaria.postgresql.org; Thu, 23 Nov 2017 22:51:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eI0Ky-0002Ap-Rr for pgsql-committers@arkaria.postgresql.org; Thu, 23 Nov 2017 22:51:16 +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 1eI0Ky-0002Af-Ji for pgsql-committers@lists.postgresql.org; Thu, 23 Nov 2017 22:51:16 +0000 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eI0Kv-0007IQ-G7 for pgsql-committers@postgresql.org; Thu, 23 Nov 2017 22:51:15 +0000 X-Originating-IP: 78.102.97.226 Received: from [10.137.2.13] (ip-78-102-97-226.net.upcbroadband.cz [78.102.97.226]) (Authenticated sender: tv@fuzzy.cz) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 8BB74A80C6; Thu, 23 Nov 2017 23:51:06 +0100 (CET) Subject: Re: pgsql: Generational memory allocator To: Tom Lane , Andres Freund Cc: Simon Riggs , pgsql-committers , Andrew Dunstan References: <20171123001649.y2nf7422iay6cw3v@alap3.anarazel.de> <20171123193936.fncfnar5wkpx56mw@alap3.anarazel.de> <21043.1511467602@sss.pgh.pa.us> <20171123214636.unwkrkunr7m2bkii@alap3.anarazel.de> <13547.1511474676@sss.pgh.pa.us> From: Tomas Vondra Message-ID: Date: Thu, 23 Nov 2017 23:51:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <13547.1511474676@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 11/23/2017 11:04 PM, Tom Lane wrote: > Andres Freund writes: >> On 2017-11-23 22:34:57 +0100, Tomas Vondra wrote: >>> Hmmm, I see. Presumably adding this to GenerationChunk (similarly to what we >>> do in AllocChunkData) would address the issue: >>> >>> #if MAXIMUM_ALIGNOF > 4 && SIZEOF_VOID_P == 4 >>> Size padding; >>> #endif >>> >>> but I have no way to verify that (no access to such machine). I wonder why >>> SlabChunk doesn't need to do that (perhaps a comment explaining that would >>> be appropriate?). > >> Can't you just compile pg on a 32bit system and manually define MAXALIGN >> to 8 bytes? > > I pushed a patch that computes how much padding to add and adds it. > (It might not really work if size_t and void * are different sizes, > because then there could be additional padding in the struct; but > that seems very unlikely.) > Thanks. Do we need to do something similar to the other memory contexts? I see Slab does not do this at all (assuming it's not necessary), and AllocSet does this in a different way (which seems a bit strange). regards Tomas