Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEAr1-0006ZH-QG for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Aug 2021 13:34:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mEAr0-0007DX-Pv for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Aug 2021 13:34:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEAqz-00078f-Sz for pgsql-hackers@lists.postgresql.org; Thu, 12 Aug 2021 13:34:38 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEAqu-0001UC-Fg for pgsql-hackers@lists.postgresql.org; Thu, 12 Aug 2021 13:34:37 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 51B965C03D7; Thu, 12 Aug 2021 09:34:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 12 Aug 2021 09:34:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=QgM/ZoVKWz79MGQzeWq2lgZe7S7UnQEp99gYHCjf1 xI=; b=aJNZwEC+yOHAyuWtD1PqXOM1LIwDb8Dctk0ihYE1+ozhhBf3vWRxFjwa9 N3XpMRXMOu/8scUcLlMKWxQaenuk3NGKhiTeeOhhkDN55DwEHhEVGHPvMrb8s7cG DZWXS3P5hVVnEKty3tKpr7vLEzDYMRDmZG62uSuAaD28t7elWmWJ0GHsVtPGu6eF 0V4HvfWcVnW07UM+VIZdewV94JGuwoy/e/Fnp/Ph8GT9GT+Q+GoDgTVnLHzI9G46 I0EtU3+fRSEc4NhvxPUpxjWsz76yX1R1daWrGblAGhK5X/2aGfX20465nfQHSql5 nKj5mhDAPJQxDtzhcavIWOtHZ2ymA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrkeefgdeihecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthejre dttdefheenucfhrhhomheprfgvthgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdr vghishgvnhhtrhgruhhtsegvnhhtvghrphhrihhsvggusgdrtghomheqnecuggftrfgrth htvghrnhephfefleefueevuddvffehjedtjeejgfelhfdtvdffheeludetudegfeeftdff ffejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepph gvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 12 Aug 2021 09:34:28 -0400 (EDT) Subject: Re: Shared memory size computation oversight? To: Julien Rouhaud , pgsql-hackers@lists.postgresql.org Cc: robertmhaas@gmail.com References: <20210227080815.jryyhy6lrn6gahkm@nol> From: Peter Eisentraut Message-ID: Date: Thu, 12 Aug 2021 15:34:27 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210227080815.jryyhy6lrn6gahkm@nol> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 27.02.21 09:08, Julien Rouhaud wrote: > PFA a patch that fixes pg_prewarm and pg_stat_statements explicit alignment to > CACHELINEALIGN, and also update the alignment in hash_estimate_size() to what I > think ShmemInitHash will actually consume. For extensions, wouldn't it make things better if RequestAddinShmemSpace() applied CACHELINEALIGN() to its argument? If you consider the typical sequence of RequestAddinShmemSpace(mysize()) and later ShmemInitStruct(..., mysize(), ...), then the size gets rounded up to cache-line size in the second case and not the first. The premise in your patch is that the extension should figure that out before calling RequestAddinShmemSpace(), but that seems wrong. Btw., I think your patch was wrong to apply CACHELINEALIGN() to intermediate results rather than at the end.