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 1oSris-0003f3-IG for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Aug 2022 03:15:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oSrir-0000Qy-Bi for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Aug 2022 03:15:29 +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 1oSrir-0000Qn-2y for pgsql-hackers@lists.postgresql.org; Tue, 30 Aug 2022 03:15:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oSrik-00034n-NG for pgsql-hackers@lists.postgresql.org; Tue, 30 Aug 2022 03:15:28 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 27U3FHQi3493602; Mon, 29 Aug 2022 23:15:17 -0400 From: Tom Lane To: David Rowley cc: Tomas Vondra , Amit Kapila , Andres Freund , Robert Haas , Yura Sokolov , PostgreSQL Developers Subject: Re: Reducing the chunk header sizes on all memory context types In-reply-to: References: <20220809184410.g6yzu6pvttuphag5@awork3.anarazel.de> <3137572.1661780863@sss.pgh.pa.us> <3205! 803.1661786437@sss.pgh.pa.us> <3207033.1661786757@sss.pgh.pa.us> <3209100.1661787561@sss.pgh.pa.us> Comments: In-reply-to David Rowley message dated "Tue, 30 Aug 2022 15:01:37 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3493600.1661829317.1@sss.pgh.pa.us> Date: Mon, 29 Aug 2022 23:15:17 -0400 Message-ID: <3493601.1661829317@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Rowley writes: > On Tue, 30 Aug 2022 at 03:39, Tom Lane wrote: >> I'd suggest reverting df0f4feef as it seems to be >> a red herring. > I think it's useless providing that a 64-bit variable will always be > aligned to 8 bytes on all of our supported 32-bit platforms as, > without the padding, the uint64 hdrmask in MemoryChunk will always be > aligned to 8 bytes meaning the memory following that will be aligned > too. If we have a platform where a uint64 isn't aligned to 8 bytes > then we might need the padding. It's not so much "8 bytes". The question is this: is there any platform on which uint64 has less than MAXALIGN alignment requirement? If it is maxaligned then the compiler will insert any required padding automatically, so the patch accomplishes little. AFAICS that could only happen if "double" has 8-byte alignment requirement but int64 does not. I recall some discussion about that possibility a month or two back, but I think we concluded that we weren't going to support it. I guess what I mostly don't like about df0f4feef is the hardwired "8" constants. Yeah, it's hard to see how sizeof(uint64) isn't 8, but it's not very readable like this IMO. regards, tom lane