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 1vRBbx-008pkK-2W for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Dec 2025 15:51:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vRBbw-003Gox-2p for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Dec 2025 15:51:17 +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 1vRBbw-003Gon-1e for pgsql-hackers@lists.postgresql.org; Thu, 04 Dec 2025 15:51:16 +0000 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vRBbu-0037ps-1K for pgsql-hackers@lists.postgresql.org; Thu, 04 Dec 2025 15:51:15 +0000 Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-7c7660192b0so953766a34.0 for ; Thu, 04 Dec 2025 07:51:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764863474; x=1765468274; darn=lists.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=QIPBHYLOYYTFOa506fGyjeI+T+Ntt4/z3RELA1u3918=; b=idxW2qxZ0zu5fsUyaOqdR61SV6zlDxX6j99hrTRNO+fqTE4U7vDhHNb3/jnaL7v4xD 6N4ewGboavj966YF57CTb7lXYj9Nm0O5Bv/NDY+ziNijzxtkEVr36g5nhX53Ki3W+mMj jWfFI4dpxD97fygiwhb0+09zq3XnXHTUTK+aMuXFHhmsG6Nk2RbP74M/aYTdP2KRxeFV DBNWb2VYJO5CFfIi4yOYt3rkeClohO9OcDQ6It38JMI1aEqXnCwX7I9mNxS+SJ2TtUqI 7P4B/wVRNXiHrW8DTjiRCgHMhRajHpvXB/cBHRWz5XM7wCVi4A2iVp50NpgpjWXzym1H GVxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764863474; x=1765468274; 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=QIPBHYLOYYTFOa506fGyjeI+T+Ntt4/z3RELA1u3918=; b=RpSfWQBGeoal6iXUNu4tUPNEDSuh61huyO2ZBif/DSugyVArd70PXXpmNUQgQdGkBP eGKhbEMJw3NfLtEfLa14LwaGBvVXMw30HEw25/UUYpKB5J2YO4S63HJBn5DJ9qIxtsxM AEoAeAi1FcV93g/0qBIvqSyC9WqvofzoakN/ScXrBhqVRlPlB99TwVzwA7vRfWbVVjo7 3MM1sV6Lll+MJZNQoiMBlnRo1UH4FrzsaCd/7OnbbMm274EHO6T0rbAJu71tIRGjZePz gB3CiVAlnQtaDHnsaB32o/8qMHuML1ukBZEadyOYlAjDZjkiq7nGgbrEP6ptYaqiPQBv OP5A== X-Gm-Message-State: AOJu0Yz1O22uaGVFFmvmZ5tjWcfFCA8W2yH2bSblInguyF46ZWkNqzb7 akp+SPrkwMiO7uRqCDFVBW2GPxdeeusHUWxes8EC9HAcfVsrZwJjM8b5wIks7Q== X-Gm-Gg: ASbGncsyl7rQjsxr85fnQf5FsOVwawj7gVoWK+ZIwA3cMJMIIRz93IdfKfKl20wrrdJ b1ZbmBBGd6aMCFX08NEMQ7JmnlarJiQLwscfWeRGAitNCbOBcKopvkTloTUiW4mLLHDT7BT4/1U W6KUclbRfxpzSmca8X5C0IAjQ1JQkM3X4T0atK3P+pQgO8hUiPdNqR/TjqNIiTZ63fR9vPK62Su pZ1fd+He98AbdIIlLEbNCk8ICXhghK964fqtwOo1P7ztm6l26DKv9kjEolcc2uIigBjB66iVpIq N8F+I/xX1L2bU5MFl7isbxKoBMuUbazslCZljoE4CGL7BbeXpaG8xrjAOEo3aWf3UXsFTBBG//7 cIypsNJRGMnea+DrtGCfNXXS/cgDVmk035u6UCgF3CgkUEd1s3l62ycyAq/d0O35IbFO6rt6LTb 9ZieLAXeM8yb/lF69ivT4ARkns7a+vc3god34/jEniJm3HeKKNaIrEvMGodPh1H8EGJ71YM+ZAj Lz4 X-Google-Smtp-Source: AGHT+IGTTs4WWKYFRfbim9cyyQz4MIld4KRqx/4okedz/qa84V9xaTnP6y+YdsxK4yuMPm1N3XcgDg== X-Received: by 2002:a05:6830:3483:b0:7c6:a2da:ce4b with SMTP id 46e09a7af769-7c94da0ed9bmr4950620a34.5.1764863474322; Thu, 04 Dec 2025 07:51:14 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7c95a8f865dsm1641537a34.2.2025.12.04.07.51.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Dec 2025 07:51:13 -0800 (PST) Date: Thu, 4 Dec 2025 09:51:10 -0600 From: Nathan Bossart To: Andres Freund Cc: pgsql-hackers@lists.postgresql.org Subject: Re: pgsql: Add pg_atomic_unlocked_write_u64 Message-ID: References: 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 On Wed, Dec 03, 2025 at 11:40:47PM +0000, Andres Freund wrote: > Add pg_atomic_unlocked_write_u64 > > The 64bit equivalent of pg_atomic_unlocked_write_u32(), to be used in an > upcoming patch converting BufferDesc.state into a 64bit atomic. I noticed that this new function was defined as ptr->value = val; and couldn't figure out why that was safe. Above pg_atomic_unlocked_write_u32(), I see this comment: * The write is guaranteed to succeed as a whole, i.e. it's not possible to * observe a partial write for any reader. ... But the new 64-bit version doesn't seem to be surrounded by a check for PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY, and I found no discussion about it in the commit message or the linked thread. Am I missing something here? -- nathan