Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1be1S0-0000E6-Bd for pgsql-hackers@arkaria.postgresql.org; Sun, 28 Aug 2016 14:52:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1be1Rz-0003as-7i for pgsql-hackers@arkaria.postgresql.org; Sun, 28 Aug 2016 14:52:43 +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 1be1Ry-0003ak-AF for pgsql-hackers@postgresql.org; Sun, 28 Aug 2016 14:52:42 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1be1Rv-00032c-5k for pgsql-hackers@postgresql.org; Sun, 28 Aug 2016 14:52:40 +0000 Received: by mail-wm0-x236.google.com with SMTP id i5so56240024wmg.0 for ; Sun, 28 Aug 2016 07:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=F0CD5aR+2w8RS0gKgoMpTL9UsXKh8vBK0nFt33yjzOg=; b=oXob55jG+WUFI8OU/AcE0FWRYfpXMGSXDeh91EHlrsBJg/pET6Xm6HEXka2fp74tR4 Cqflo+935Fszhxa2gP9J++/ZpIxIq5m31x3SOpIOasQ25ojx64fTh2jENlhSL46nusjo TafoRk4pWkinWQuNSuclUKg4bgJjMZJ/wB5KDour9c6RYv8sCMy9LOpDwnZcmftuwjGP HyehXyU9tOeUuWBD0fZ3yLSJGx24vL+whVBUvefnzShX9oPyFg3snxWUfazVrNzW6kmu 2nrxJEelOyd9a40xhHEoi5CAcT04NUm+zz7PCj9Palr9lP31NLv1XQjiuykO0xdWIinm O5DA== 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:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=F0CD5aR+2w8RS0gKgoMpTL9UsXKh8vBK0nFt33yjzOg=; b=eoGzww8AdSXU0FCpSIjvEGjfqPfvHR++fTlIaUAqcHMmbPdQUNqUDzk+VbjaNk/Lgp O6V8s3nYPOKR2pqdeyTuk8xEdDVi1r/bbrY+M/Ut6ImYkmgS9al1DxjujwO4oeZkWotl Um5w6T/wM49Px79uWMEDfRFVxt0/Ch2/CMBh5mJ/bq3eLr6/34hFc7I4IM59uLaStA25 G7415s0CElk1gAkET3DSxXAcqk08fVPOtu9I4F7RJ4uC2Bv89T57szfqQYHSld/Q+eB9 zNB4TUdjyH+hjdXvxzMYcN9kv/8tQO0jHFIHthYw+xYH3TMw3rZ/Ye6B+FmxRhkFKuK7 X12g== X-Gm-Message-State: AE9vXwM/up6rWa+112kJbJ+l/GV49sMAPzB4nO9sHPczR8eq7q3Po/vqRZMS5EqTiJEr0Dts158Tneju6P8BRyCtDlARDTPZZGTBDnw7xEMQgNydks24YqdqvQcuxIX+D8FQQLo5GpCgPrfOmCRxBZBxJXtgkYGrni1iSgh82BGUDzTuvzaQTKmsiK2LovIhUYEHJO+Rw5vi X-Received: by 10.28.99.86 with SMTP id x83mr6800456wmb.95.1472395955481; Sun, 28 Aug 2016 07:52:35 -0700 (PDT) Received: from [10.137.2.17] (ip-89-177-44-58.net.upcbroadband.cz. [89.177.44.58]) by smtp.gmail.com with ESMTPSA id pm1sm29708958wjb.40.2016.08.28.07.52.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Aug 2016 07:52:34 -0700 (PDT) Subject: Re: Bogus sizing parameters in some AllocSetContextCreate calls To: pgsql-hackers@postgresql.org References: <21072.1472321324@sss.pgh.pa.us> <14922.1472395319@sss.pgh.pa.us> From: Tomas Vondra Message-ID: <921fabd9-727a-bf7f-2819-ff39cb6362ae@2ndquadrant.com> Date: Sun, 28 Aug 2016 16:52:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Thunderbird/46.0a2 MIME-Version: 1.0 In-Reply-To: <14922.1472395319@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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 08/28/2016 04:41 PM, Tom Lane wrote: > Robert Haas 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