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 1wKI1i-000oTx-06 for pgsql-hackers@arkaria.postgresql.org; Tue, 05 May 2026 15:49:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wKI1g-00CmgR-31 for pgsql-hackers@arkaria.postgresql.org; Tue, 05 May 2026 15:49:36 +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 1wKI1g-00CmgJ-26 for pgsql-hackers@lists.postgresql.org; Tue, 05 May 2026 15:49:36 +0000 Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wKI1e-00000000fhP-2ymV for pgsql-hackers@postgresql.org; Tue, 05 May 2026 15:49:36 +0000 Received: by mail-qk1-x72b.google.com with SMTP id af79cd13be357-8ee7ffd738dso347485a.1 for ; Tue, 05 May 2026 08:49:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777996173; x=1778600973; 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=TyII6evI9dCmsnBRbi+EvjXS8yDmoIl1imVYPkgOe54=; b=H084mMBZ3oT39GFZ4xYXDbDzcQigMwfLhSTdsegIH/32iqC3KQgNCD9k5zSvYx5Fp8 CYY0VABu02JAIKw6tPsZ8xedSzdRER4ckzc7OZHzTxpHmVexQZjTACACPfSP8ChudRJJ 1duqRGTsvpbLlNyodEnqWYIcqIwd38+gtig/8l8S7c222IqvPqRdLNHCJBTSzD/Q6s/J u4yXIn4mOQfEtG1BkqLMJfn66Ql5nsdFtqZGwn7rDNmLMsTtg2hoW5pdEtjljSjoIE8W LFtlYs4ElGYe7mZmBJKnJ/u9dix7juQJ8AeuZmT/tSH7dXN45S2f8n4lxyR19I1ug2Ew k/pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777996173; x=1778600973; 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=TyII6evI9dCmsnBRbi+EvjXS8yDmoIl1imVYPkgOe54=; b=k7nUFnACfrTz2+zfHBcHKB+pedeeqWYXrqvlPgA1yLNes72CZEMVkDVigScsQZMVOG yAMVyqoJWlhzyLcmikHEAd0VbmKXZz8POwnVn8h478eJrx/O93lz0Y8jwSa5nl38ImoV ZUiIsKls0184clJ4xj0Fobpxkurpm7XAG4rj1bMwaQatYln8mbcvl43yZ0wVk4iL5cyK VWahluD0Kmhd7gJuUCJLVfqqgrx4P7QhwEEez2g2QTPD4pyqzoHe/Gmg18sfgJN3nU0j QexWBCuQlqBq+XoXi08gp7ZsDfuU1It2bFwqFs+psKrJnLK+I/WTfawEnsfdijbtL9zt Untg== X-Gm-Message-State: AOJu0Yw3xmlDc5QcPlPnH5aGpgl8R4ICononbDjhKV4fgkRE7cRj+Dam vZ4/8RtHXdRoR6y/D7Q5lYEaO4sQ969MsAOhw90VI1e5SYbvUufFXebj X-Gm-Gg: AeBDiev19ReL27Z50Eszkej+ga1Lc+qOBieSByxIkjcbpRPgfujsWMTUZvQeso0IYdr qNsgB96ZODDsuCHkYTxXJ6l0H7F3Djv6JBnnHWnXAh4aMOZs+jZi+qTZS7b3I/XbYuY3s2Cg+Z2 LJRfY1NNwpPuBtDmmteSk71gAcJe3CkjNd7Lu8dsok6QozLauwxNeGqNu8XwEvjf22bl+4rog54 AQ1H18YHzAqaJXjB0aODgd2UN56nRegk5HQ1qWjua8dkyj2LcQsCIWvQLqTNACJgUCYKeBFm10t 2FmJA1o8igXlclSdLEKwt+em8n0jB1xE1dvbdKXDFZQUosm/LM+gvTmwHgdoTHDjy+pLc8d8//A DUIdjJfoN0JRRVvAYZwHdajXkaH6O3KJ+86DIELW0OoOUYHRfN9A5qKBC5q0KqofsU9Gg5ZEARt eNo4qjJRO70LfXFL/5UMHtDpL3LU8Jyf16Zt++lO6sy9tFvK/HBd3xpWE/L4ulaglB6dUUG1SFs uTqK1TAe2G3NW5PTcer2SI00qp4bEjF X-Received: by 2002:ac8:5883:0:b0:50f:bd19:657b with SMTP id d75a77b69052e-513052eb08emr53775721cf.10.1777996172570; Tue, 05 May 2026 08:49:32 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-51040b5d1f8sm125912911cf.22.2026.05.05.08.49.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2026 08:49:31 -0700 (PDT) Date: Tue, 5 May 2026 10:49:30 -0500 From: Nathan Bossart To: Tom Lane Cc: pgsql-hackers@postgresql.org Subject: Re: small cleanup for s_lock.h Message-ID: References: <369933.1777933007@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <369933.1777933007@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, May 04, 2026 at 06:16:47PM -0400, Tom Lane wrote: > Nathan Bossart writes: >> I'd like to rewrite the comment at the top of the file, too, but haven't >> gotten to that yet. I find it a little misleading, especially because >> we #error if TAS isn't defined. > > No objection in principle to improving that comment, but what did you > have in mind exactly? I think the way the comment presents the macros gives a potentially misleading impression about what you typically need to do to get a new platform working, and you basically need to read through the whole file to make sense of what's going on. Some of the macros it mentions have a default implementation that we use everywhere (e.g., S_INIT_LOCK), and if you're using gcc, you may be able to just use the __sync_lock_test_and_set versions. If you _did_ need to add a new section for a new platform, you'd probably be more interested in defining slock_t, HAS_TEST_AND_TEST/TAS, S_UNLOCK, SPIN_DELAY, and maybe TAS_SPIN. In fact, you _must_ ensure TAS is defined or else we'll fail to compile. Although as I write this e-mail and think about how exactly I'd rewrite the comment, I grow less confident about doing so... -- nathan