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 1jxx57-0006zl-6w for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Jul 2020 18:33:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jxx56-000155-3b for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Jul 2020 18:33:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxx55-00014y-T9 for pgsql-hackers@lists.postgresql.org; Tue, 21 Jul 2020 18:33:35 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxx4z-0007ET-N4 for pgsql-hackers@lists.postgresql.org; Tue, 21 Jul 2020 18:33:34 +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 06LIXNn81058725; Tue, 21 Jul 2020 14:33:23 -0400 From: Tom Lane To: Andres Freund cc: pgsql-hackers@lists.postgresql.org, Antonin Houska Subject: Re: xl_heap_header alignment? In-reply-to: <5A0F3128-D990-4431-9E97-793CD99FF11E@anarazel.de> References: <21643.1595353537@antos> <5A0F3128-D990-4431-9E97-793CD99FF11E@anarazel.de> Comments: In-reply-to Andres Freund message dated "Tue, 21 Jul 2020 11:02:11 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1058723.1595356403.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 21 Jul 2020 14:33:23 -0400 Message-ID: <1058724.1595356403@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On July 21, 2020 10:45:37 AM PDT, Antonin Houska wrote: >> I don't quite understand this part of the comment of the xl_heap_header >> structure: >> * NOTE: t_hoff could be recomputed, but we may as well store it because >> * it will come for free due to alignment considerations. > Unless you declare them as packed, structs will add padding to align mem= bers correctly (if, and only if, the whole struct is stored well aligned). I think that comment may be out of date, because what's there now is * NOTE: t_hoff could be recomputed, but we may as well store it because * it will come for free due to alignment considerations. */ typedef struct xl_heap_header { uint16 t_infomask2; uint16 t_infomask; uint8 t_hoff; } xl_heap_header; I find it hard to see how tacking t_hoff onto what would have been a 4-byte struct is "free". Maybe sometime in the dim past there was another field in this struct? (But I checked back as far as 7.4 without finding one.) I don't particularly want to remove the field, but we ought to change or remove the comment. regards, tom lane