Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eDa03-0005IY-FR for pgsql-bugs@arkaria.postgresql.org; Sat, 11 Nov 2017 17:55:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1eDa02-0003c7-F4 for pgsql-bugs@arkaria.postgresql.org; Sat, 11 Nov 2017 17:55:22 +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 1eDZzH-0002Hz-Qu for pgsql-bugs@postgresql.org; Sat, 11 Nov 2017 17:54:35 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eDZzF-00085r-Ai for pgsql-bugs@postgresql.org; Sat, 11 Nov 2017 17:54:34 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vABHsTmd004613; Sat, 11 Nov 2017 12:54:29 -0500 From: Tom Lane To: Andres Freund cc: Dmitry Dolgov <9erthalion6@gmail.com>, Michael Paquier , Vincent Lachenal , PostgreSQL mailing lists Subject: Re: BUG #14897: Segfault on statitics SQL request In-reply-to: <20171111174512.ikd3zrx2i5ssxpww@alap3.anarazel.de> References: <14075.1510352167@sss.pgh.pa.us> <17617.1510355215@sss.pgh.pa.us> <644.1510418216@sss.pgh.pa.us> <20171111171620.td6vtnmijcloj6k5@alap3.anarazel.de> <3914.1510422100@sss.pgh.pa.us> <20171111174512.ikd3zrx2i5ssxpww@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Sat, 11 Nov 2017 09:45:12 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4611.1510422869.1@sss.pgh.pa.us> Date: Sat, 11 Nov 2017 12:54:29 -0500 Message-ID: <4612.1510422869@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Andres Freund writes: > On 2017-11-11 12:41:40 -0500, Tom Lane wrote: >> Yeah, changing MAXALIGN is out of the question. I'm thinking about >> another flag bit for MemoryContextAllocExtended. Do we need to think >> about other use-cases besides int128? Should we just force 16-byte >> alignment on all architectures, or does it need to be platform-specific? > I'm not sure we want to > a) Rely on one alignment being enough for everybody. > b) Additionally burden already hot code paths with a growing number of > alignment flag tests, and the necessary math. Well, (a) we could have more flag bits later if there are other use-cases that require even stricter alignment, and (b) I do not believe that MemoryContextAllocExtended is a hot code path at present; there are not enough call sites. > How about a MemoryContextAllocAligned(context, size, alignto, flags) > that passes on most flags but adds the necessary overhead to size, and > padds the result appropriately? This'd result in hard-wiring the alignment requirement at call sites, which I think might not be a great idea. For example, one plausible future use-case is "align on cacheline boundaries". I think that would be better served by a flag like MCXT_ALLOC_ALIGN_CACHELINE than by having the callers demand a specific numeric alignment value --- it'd be a lot easier to make the alignment match actual hardware requirements if it were being inserted at one specific place. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs