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 1vpth7-000rEX-0q for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Feb 2026 19:46:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vpth5-000nEt-1h for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Feb 2026 19:46:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vpth4-000nEk-1t for pgsql-hackers@lists.postgresql.org; Tue, 10 Feb 2026 19:46:44 +0000 Received: from fhigh-a6-smtp.messagingengine.com ([103.168.172.157]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vpth2-0000000023u-1qtA for pgsql-hackers@postgresql.org; Tue, 10 Feb 2026 19:46:43 +0000 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id D947714000B2; Tue, 10 Feb 2026 14:46:37 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Tue, 10 Feb 2026 14:46:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1770752797; x=1770839197; bh=VKDqqMba6w Y4PbNuOHXtvvqEcAHfCan8hJ8XMpLezyg=; b=WTTGOJxauyZ7nPH/dGEBPD1BUY xIU74KsvYo/aFEE7lcIXotqAYouSg5OW8ptvC9Buk/YrVUz3J6V43lMr7Dfi4378 xM7DMk6RrceAGZs5aQGs0njHL7umfiAIYifAgMlBFY8ybqzz12fRueT9AWeYpCXR en38k3c5YlzQtjklj1LN6JFx8Cf83oC6OpgM5LJJjE0RkFh7cP0aytiRHwvEmu7U lKl7i2vxRYbeq7ygaQFTumFHPjD4Nwsa/02ufZjoE5OXXo2WrKhZxw1//Ps8QOwy p/dnsTdFJiKPNHUb6StRqsCtvtx1UTo4QAdJDcMf6X4Gr5E2/KeZtwGzMxoQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1770752797; x=1770839197; bh=VKDqqMba6wY4PbNuOHXtvvqEcAHfCan8hJ8 XMpLezyg=; b=p3zvZTtrQ3audOtCpmMvysvKDHRrW+HhCqGq16iZ8HdJd1McLUr 9MA0555ZVc62edqk06zKut4GLMJ6qM8oew5PB9DMn4q6s/m0bFi+IWUd/oy9GJ1y LAwRe1nJGwU6ofZlDDDm1we5yWZrqvwvaAIHrieGbrHTH7MWLvrZN78t2Xdrzl8r ejIpZJcovAgEUN+hltRj2HSQo/pl3oQBRy5VEuMSXwMPgUf0n3Mv1INBr31qmSim WcNgLZlVdSAyTd75g00R2itcAqgtChf5ASs/vCuOMVdFLfDZg9sIN32+KvHR8Ts7 I6hnQuuFlPlkuYVEtLkJ+I7DyFuGWWJ+EvA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvtddtheehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrth htvghrnhepvdfffeevhfetveffgeeiteefhfdtvdffjeevhfeuteegleduheetveduieet tddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hnughrvghssegrnhgrrhgriigvlhdruggvpdhnsggprhgtphhtthhopeefpdhmohguvgep shhmthhpohhuthdprhgtphhtthhopegsvghrthhrrghnuggurhhouhhvohhtrdhpghesgh hmrghilhdrtghomhdprhgtphhtthhopehhlhhinhhnrghkrgesihhkihdrfhhipdhrtghp thhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 10 Feb 2026 14:46:35 -0500 (EST) Date: Tue, 10 Feb 2026 14:46:31 -0500 From: Andres Freund To: Bertrand Drouvot Cc: Heikki Linnakangas , "pgsql-hackers@postgresql.org" Subject: Re: PGPROC alignment (was Re: pgsql: Separate RecoveryConflictReasons from procsignals) Message-ID: References: <1cb0d7e9-d6dd-4517-a7cd-0ad98e1207f3@iki.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2026-02-10 19:15:27 +0000, Bertrand Drouvot wrote: > On Tue, Feb 10, 2026 at 01:15:01PM -0500, Andres Freund wrote: > > On 2026-02-10 19:14:44 +0200, Heikki Linnakangas wrote: > > Yea, I don't think we need to be perfect here. Just a bit less bad. And, as > > you say, the current order doesn't make a lot of sense. > > Just grouping things like > > - pid, pgxactoff, backendType (i.e. barely if ever changing) > > - wait_event_info, waitStart (i.e. very frequently changing, but typically > > accessed within one proc) > > - sem, lwWaiting, waitLockMode (i.e. stuff that is updated frequently and > > accessed across processes) > > With an ordering like in the attached (to apply on top of Heikki's patch), we're > back to 832 bytes. You'd really need to insert padding between the sections to make it work... > But, then the pg_attribute_aligned() added in Heikki's patch makes it 896 bytes... > > " > /* 816 | 16 */ dlist_node lockGroupLink; > /* XXX 64-byte padding */ > > /* total size (bytes): 896 */ > } > " > > What about applying this new ordering and remove the pg_attribute_aligned()? > (I thought the aligned attribute would be smarter than that and not add this > 64 padding bytes). That's just because we have /* * Assumed cache line size. This doesn't affect correctness, but can be used * for low-level optimizations. This is mostly used to pad various data * structures, to ensure that highly-contended fields are on different cache * lines. Too small a value can hurt performance due to false sharing, while * the only downside of too large a value is a few bytes of wasted memory. * The default is 128, which should be large enough for all supported * platforms. */ #define PG_CACHE_LINE_SIZE 128 I don't think we need to worry about the number of bytes here very much. This isn't much compared to all the other overheads a connection slot has (like the memory for locks). Greetings, Andres Freund