Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w25wQ-000sLD-0u for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 11:16:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w25wP-009WXw-11 for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 11:16:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w25wP-009WXo-06 for pgsql-hackers@lists.postgresql.org; Mon, 16 Mar 2026 11:16:57 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w25wM-000000000Cq-1HMO for pgsql-hackers@postgresql.org; Mon, 16 Mar 2026 11:16:56 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4852ff06541so50215475e9.2 for ; Mon, 16 Mar 2026 04:16:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773659813; x=1774264613; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=HISCVH2t1bfPRBWXtJrYKJNrZTZoT+u7sx1uP52i8/A=; b=FDhtFxjtB2b7TxUO9x1xQtTs5DSHHpiOYUrTFOP5TmQIgJ+wqJ44t3rs+TmR7bA+8D lCmicmYe84Q3b55mznE+e1H+aWjVzWWLBdiwvWhXB+d7vjTDwCDPI68E+c3RUbMxD3Dv ESRONVcOQIzkpyJ8+uYJKiTgv2QUAOmtdY20aWM0kHAV13dFVhIevExUiwLOzqfGVOM7 aKLEvOMHSf5LJ4ppuc7b4q2zUHmH0c+MAftE6PfRyFDObkiI6ct8SO21UgeiUhhAHu5v NdsVvvAvpoKMa3cEleKXulWKALMTxlykvKVYqXT8aNxsZOn0oUeqJBA2f7XqpYxbD+rZ vd5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773659813; x=1774264613; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HISCVH2t1bfPRBWXtJrYKJNrZTZoT+u7sx1uP52i8/A=; b=qelX/cVx5zFpl0P9aeywL4NTNWQBG6Xnv0jqf/ZdIZglblGgcm1NL5o5LSYTWmF5bX dL/HZmVeM6EEVWKim2Ls1+ipA8EFeh5IEyuXfj8Dlv2jzFFQeoVpFWRxQC+5+wMdDunW aTsyjkG2wu8o/qgejpy//IpKFeSUwvMqhrgY90/+FFo5fwTn9lAl2ds+GjmqAgJhnNrI 8mBBMGXOlXLi7d8858krkVwke2hM2iS+kJBVrwyYgNlHA6LaHtpDrfjOToApRPCji0fL Q8KIgeYZEUgf4AMhOEYiqDGa8PzVdp4G89XQ2Y88XuGDKskR/mTGbqgvYU60sFDqd/uh M/qA== X-Forwarded-Encrypted: i=1; AJvYcCXPrnruBXQQcgjISe/dY7J7b+DJFMXhlAGsrsnhjgmodMFkCow4uf8Ato4LeDs1VRCEG+GXAKuHbMZvqzoh@postgresql.org X-Gm-Message-State: AOJu0Yw7uzMtDvJykpxZLVQu23qvAFw5cODalN2+C3OBij0ngp27yRGD p0KX0D94d9e3v8GSPieAnIwfj35Rf7Mz2krzfS//uufyCGin3jlRrNS7 X-Gm-Gg: ATEYQzzJpJFpAvSiXLJTSGx+qssoXjQ+pR92GSZi0bWVK+D3JAGksQ+RkleNjrGLigk xnq1zSudYc6T9yTMg81I+v23IvgozEuE21vGgU5fuFwz+DHVD8Sq8aHsbBgCep7wRXcZ1berFBV bWzNAr2L4J0/QQHR5G/uEuooPvulZ0bcUpJhzPzxzhyH++mUTxAPkke4cI+iQG8bFD/23uuc/Td ShY2xIB5hG70qf0FaK6nSWUmQSell0wtHFtMuLAFtfnhxBnqpvNrx7p7E5akCT7QEj2NQVKwt0u aRK4+mSfpq3qCQ+nJHi38AsYtOsi0slam84evhaX3LofOGjrI+VRD4KTW5v/jRwqE3x5iA69Dqd I2QnsxTlmjdBGqhTh5n0lyyhEVep1tuvYe3/MsSoFvTYZWaNKljXflBMZno3ip/Xzn+wwkqTl+C K8QpGDlyMP+KuSYWwEhOSF9aXcjf9lw+q6T2c+rMM2WdyjUDYJDFdZTzMAhGZUudbcUlv+rQ2a7 wR0GQnCfa0yp4NybH4Bcj6uXiEbihSK3hSsmEbQv7fsPFt1JWfhsxN6eA== X-Received: by 2002:a05:600c:1388:b0:485:3dfc:57d with SMTP id 5b1f17b1804b1-485567148d7mr216816485e9.30.1773659812915; Mon, 16 Mar 2026 04:16:52 -0700 (PDT) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe2186e3sm46829445f8f.26.2026.03.16.04.16.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2026 04:16:52 -0700 (PDT) Date: Mon, 16 Mar 2026 11:16:51 +0000 From: Bertrand Drouvot To: Peter Eisentraut Cc: Heikki Linnakangas , Andres Freund , "pgsql-hackers@postgresql.org" Subject: Re: PGPROC alignment (was Re: pgsql: Separate RecoveryConflictReasons from procsignals) Message-ID: References: <3dd6f70c-b94d-4428-8e75-74a7136396be@iki.fi> <787be980-0878-4f4a-be01-d042ab5d370e@iki.fi> <3ff35999-7a1e-40fa-938c-f2bff85e2e2f@eisentraut.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3ff35999-7a1e-40fa-938c-f2bff85e2e2f@eisentraut.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Mon, Mar 16, 2026 at 11:42:35AM +0100, Peter Eisentraut wrote: > On 24.02.26 12:28, Bertrand Drouvot wrote: > > > You can/should use C11 standard alignas(), so you don't need to worry about > > > whether it's supported or not. > > > > Oh right, I did not notice 300c8f53247 and following like e7075a3405c, d4c0f91f7d5 > > and 97e04c74bed. > > > > PFA, 0001 doing so for PGPROC and PgAioUringContext. As those are typedef, > > the patch puts alignas within the struct. > > > > For PGPROC at the start of the struct, I think that placing it on the first member > > is the right location because it ensures the whole struct is aligned to PG_CACHE_LINE_SIZE > > without adding padding before this member. For example if I set it on backendType, > > then it adds 100 bytes of padding and the struct is obviously still a multiple of > > PG_CACHE_LINE_SIZE but is now 1024 bytes (instead of 896). > > > > For PgAioUringContext at completion_lock (like suggested by Andres in [1]), which > > is also the start of the struct. > > > > I checked and the padding for those are exactly the same after the changes. > > I have committed the 0001 patch. Thanks! I don't know why but I don't see it in https://git.postgresql.org/gitweb/?p=postgresql.git;a=summary, or in the github repo though. > > 0002, is also making use of alignas in ItemPointerData, but this one is more > > tricky so I'm not sure that's worth it (given the fact that we still need to > > keep pg_attribute_aligned() as explained by Peter in [2]). > > This doesn't seem worth it to me. Let's skip it. Yeah, that makes sense. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com