pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: pgsql-hackers@postgresql.org
Subject: Re: Bogus sizing parameters in some AllocSetContextCreate calls
Date: Sun, 28 Aug 2016 16:52:32 +0200
Message-ID: <921fabd9-727a-bf7f-2819-ff39cb6362ae@2ndquadrant.com> (raw)
In-Reply-To: <14922.1472395319@sss.pgh.pa.us>
References: <21072.1472321324@sss.pgh.pa.us>
	<CA+TgmobNcELVd3QmLD3tx=w7+CokRQiC4_U0txjz=WHpfdkU=w@mail.gmail.com>
	<14922.1472395319@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 08/28/2016 04:41 PM, Tom Lane wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> Also, I think we ought to replace this code in aset.c:
>
>>     initBlockSize = MAXALIGN(initBlockSize);
>>     if (initBlockSize < 1024)
>>         initBlockSize = 1024;
>>     maxBlockSize = MAXALIGN(maxBlockSize);
>
>> With this:
>
>>     Assert(initBlockSize >= 1024 && initBlockSize == MAXALIGN(initBlockSize));
>>     Assert(maxBlockSize == MAXALIGN(maxBlockSize));
>
> Good idea --- if we'd had it that way, these errors would never have
> gotten committed in the first place.  I'm for doing that only in HEAD
> though.
>

Then maybe also add

     Assert(initBlockSize <= maxBlockSize);

And perhaps also an assert making sure the minContextSize value makes 
sens with respect to the min/max block sizes?

I'm however pretty sure this will have absolutely no impact on profiles. 
It might save a few cycles, but this only runs when creating the memory 
context and all profiles I've seen are about palloc/pfree.

It might matter when creating many memory contexts, but then you 
probably have other things to worry about.

regards

-- 
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-hackers



view thread (13+ messages)  latest in thread

Message-ID: <921fabd9-727a-bf7f-2819-ff39cb6362ae@2ndquadrant.com>
Permalink:  ../921fabd9-727a-bf7f-2819-ff39cb6362ae@2ndquadrant.com/
Also on:    postgresql.org/message-id/921fabd9-727a-bf7f-2819-ff39cb6362ae@2ndquadrant.com

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tomas.vondra@2ndquadrant.com
  Subject: Re: Bogus sizing parameters in some AllocSetContextCreate calls
  In-Reply-To: <921fabd9-727a-bf7f-2819-ff39cb6362ae@2ndquadrant.com>
  References: <21072.1472321324@sss.pgh.pa.us> <CA+TgmobNcELVd3QmLD3tx=w7+CokRQiC4_U0txjz=WHpfdkU=w@mail.gmail.com> <14922.1472395319@sss.pgh.pa.us> <921fabd9-727a-bf7f-2819-ff39cb6362ae@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