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 1wK1at-000VMg-1G for pgsql-hackers@arkaria.postgresql.org; Mon, 04 May 2026 22:16:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wK1as-009BTl-0v for pgsql-hackers@arkaria.postgresql.org; Mon, 04 May 2026 22:16:50 +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 1wK1as-009BTW-00 for pgsql-hackers@lists.postgresql.org; Mon, 04 May 2026 22:16:50 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wK1ap-00000000DF1-39uO for pgsql-hackers@postgresql.org; Mon, 04 May 2026 22:16:49 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 644MGlwL369934; Mon, 4 May 2026 18:16:47 -0400 From: Tom Lane To: Nathan Bossart cc: pgsql-hackers@postgresql.org Subject: Re: small cleanup for s_lock.h In-reply-to: References: Comments: In-reply-to Nathan Bossart message dated "Mon, 04 May 2026 16:49:44 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <369932.1777933007.1@sss.pgh.pa.us> Date: Mon, 04 May 2026 18:16:47 -0400 Message-ID: <369933.1777933007@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nathan Bossart writes: > I noticed that s_lock.h points to a default implementation of tas() in > tas.s or s_lock.c, but AFAICT there hasn't been a tas() implementation in > s_lock.c since commit 718aa43a4e, and commit 25f36066dd seems to have > removed the last remaining tas.s files. So, I think this is dead code. It is, but I think the 0001 patch should be more like #if !defined(TAS) -extern int tas(volatile slock_t *lock); /* in port/.../tas.s, or - * s_lock.c */ - -#define TAS(lock) tas(lock) +#error "must provide a spinlock implementation" #endif /* TAS */ Perhaps this could be merged with the earlier bit about erroring if not HAS_TEST_AND_SET. > I also noticed that HAS_TEST_AND_SET just means that TAS is defined, so I > wrote a 0002 that removes it in favor of checking TAS directly. I'm pretty much -1 on that; HAS_TEST_AND_SET is clearer than TAS, and removing it seems quite likely to break someone's code. We could perhaps collect all the separate instances into this end location: #if defined(TAS) #define HAS_TEST_AND_SET #else #error "must provide a spinlock implementation" #endif /* TAS */ > 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? regards, tom lane