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 1wKIKF-000one-3B for pgsql-hackers@arkaria.postgresql.org; Tue, 05 May 2026 16:08:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wKIKE-00CrPp-0D for pgsql-hackers@arkaria.postgresql.org; Tue, 05 May 2026 16:08:46 +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 1wKIKD-00CrOm-2J for pgsql-hackers@lists.postgresql.org; Tue, 05 May 2026 16:08:45 +0000 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wKIKB-00000000fqv-2jFw for pgsql-hackers@postgresql.org; Tue, 05 May 2026 16:08:45 +0000 Received: by mail-qt1-x830.google.com with SMTP id d75a77b69052e-5102582e23eso40636981cf.1 for ; Tue, 05 May 2026 09:08:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777997322; x=1778602122; 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=zD9PD6/O/I+9/Vz6nRl/B7PRhPZzC9Xy8NcpP3QSzFo=; b=cWwWPu5eypkOr/UjV7aEsAEw9gfa319OoUJHYO2Ltr1Jocr4GXKpLqn5AOOSNq6O1m XnjnUPKGW6coOCjqthvzBFpxfrB1ihwZ9vIsid74Lznsqt+Am9aUNqXRQ7XW+HuV5wbz LM0tV7XclvMjzpROKLZClYwvHSnmxGzfWVP7MR/dqB1ysM1fjBYemz/REYyWBHL7mwIe IU3apA4iWTcyX3o+jUI/oKM6jz6W+eGKMtjvzYLt1NAD4uaoL/Z56FXFa1+AOl2wTpTT QSMe9/wDK1V2N5syK8N+PrJxmI6Rab+1h3glu+7HGXdvJuANM3EqyKXB4ewejv/PabdQ IGmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777997322; x=1778602122; 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=zD9PD6/O/I+9/Vz6nRl/B7PRhPZzC9Xy8NcpP3QSzFo=; b=fhOYfTTO1UC2Ykdf/8G1cMypbqoNMxLiZcdDRECyuur6UDvyNTLQmvI1XcD48526/v Rzf6aT8rRfawRenMLgYU8Jjqa/TVHuQuUOAvxMiJZLI5oFBu4zKreDatllc0JGpabyoC Wabh8+J0WDryS6rmWi1QfOfQmcQ/+inEnAK8JO/S6zM10JEIgfIskXJ5yXkbkEppv+Fn O2exf6Kohs7dl5Qmb8wyWdIfYGtpI9Yih1peLtL9q8aFQWBaoz1pjNuutz3I9lY5AqPO HHWkYN8EXpFGjX6vsza5RKmlaYwtqlFK8+Q1O31y7/QHiXDKHt9pNzeBwyu3XQoQo46f TGPg== X-Gm-Message-State: AOJu0YxQu0Rha5pphKA8zl+jHaQDvS+kzk4ncTLLZmTHpVwTlqvnT7Bp cbptJBfkhQnSUxACWHr9Gh1PUKc3SBJmHMoPzfSDliuWOZ1gQO3D15kg X-Gm-Gg: AeBDietTa+wPBC/32D8eqBkfP6hPYyeRG4n7BfGUorOOKkOErBGyIPgnqWRZOlzwdDV SDR6uofjX/ISnQcdfyTXKeYPZw65yDLV9kGOB9DWOFzvcfkTf8aytlpp7r+xr0Mu2T/goaRwXXz M9hX3hCKV6tMqcp4rJBvwK8Iu74XvVpjFe+OTJccWsJFXEVspIZxZbgi9t6jaWZw1hOumTBl0Hh xFJwKMQOK8O/Id92VgIzt2++O/W2qlkayvYHo06GoTKoGbPECs2bdNnY6i+nX+jiDmW87l1NF5+ a/jox/CXpHmLhw4ICrTytWvbhtkCGPKXQxU/iqjApLsjknpph1/8vUj8AyHcnO61sT7WVaGjfDW 1N7unC99Mid8odwWZ4A4pgEgfSHrJuarPmWgg4PV+Gg7mEecq7BJQHMCWw/xTwWLfAP312fcWTO BA8zuUG1F+Rc3wgZUJctwDDIvzGA79QBsOqtaE/TlCwvY7hVnnad0AZEMTKIkr6gamQK9BlaxaL o87A91nDyAqoeuqdDbO/cU6NDu/oqCe X-Received: by 2002:ac8:5ac8:0:b0:50d:9b07:9c46 with SMTP id d75a77b69052e-5104bef2b99mr222706141cf.33.1777997321520; Tue, 05 May 2026 09:08:41 -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-5104090a381sm146034111cf.8.2026.05.05.09.08.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2026 09:08:40 -0700 (PDT) Date: Tue, 5 May 2026 11:08:38 -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: multipart/mixed; boundary="UnKLvPhhsIm7C55J" 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 --UnKLvPhhsIm7C55J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, May 04, 2026 at 06:16:47PM -0400, Tom Lane wrote: > 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 */ Okay, here's a new version of the patch that I believe addresses both points. -- nathan --UnKLvPhhsIm7C55J Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v2-0001-fix-up-TAS-in-s_lock.h.patch