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.94.2) (envelope-from ) id 1tVaXa-009nK5-GB for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Jan 2025 18:12:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tVaXZ-004KBU-2r for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Jan 2025 18:12:24 +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.94.2) (envelope-from ) id 1tVaXY-004K9Z-Ob for pgsql-hackers@lists.postgresql.org; Wed, 08 Jan 2025 18:12:24 +0000 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tVaXV-000Ynl-2y for pgsql-hackers@postgresql.org; Wed, 08 Jan 2025 18:12:23 +0000 Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-84cdacbc3dbso1992639f.2 for ; Wed, 08 Jan 2025 10:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736359941; x=1736964741; 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=Lqgf8bEGkOL8U/eJ53Ho0+5MjzWH9bl1Fk6h2wMOhNQ=; b=MuyROBK3avZiZTXrUOrb5SK21+W+ZgYBh+ibjCa0tKpT5pj7YlQFLHv8Bj2f6o8mtA C6jGu1i2NtM/18f5pyhbjMcBkieNz28OegOTdYxu+XRkXl7DDlQ8Xim1RjST3CeSDGum At+DPA1chtwEoTGHrK+vkcEms4uLjGWwUIwlsaOSYAnu5qWHc2uvnmU/aiwe8bkqfsH5 RrMzOWxaO4sS41J0jIYD8CiQxoDf9ApkMi8sdTQD84rJjxqxzeGUXxC/1Y+kZy5KHXjf tsYkGIvypFS+rdN/Rad7dmiPHfES08T9dNQ9gSkXa1F+qopoA136svVoHmpHEbJXPtcs fjLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736359941; x=1736964741; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Lqgf8bEGkOL8U/eJ53Ho0+5MjzWH9bl1Fk6h2wMOhNQ=; b=v6EBrBHb7ilGDxwxFop733kgIHgA03nenQ7gFtvheLR8qpGdbpBNtjhxgy+LbncOnb ngndmIpEatLQ9v9YAP+Lm0/u72EdnE5vyuPQuYFxhi/zipD6BzNgkN+hp4JqqfGHAmVC VdY7GkrorFIOhkZzvrW+0tGcooxIZBvwqKU8wT0lHeidAHh/aP/e/DkPyteiW2L5NBGI k2B4KMfrPrFFMsz8dkR8OEqgV5DXDk/VcBrqdkSxWcYL47+TcbrGfY3qvN9uqU2NuXwQ g0SmT9fNLAlikCMgLGY/tIgSSiOQBoykstJxt6kdrwAlc1SPxHrFrtuEDCAydjM2gPiy 8ZEA== X-Gm-Message-State: AOJu0Yw5UnEw5gJgZj9g3EP8Jqvu3gjLv3KJ1K6GAOLx9BlgOaE0Ds1R PimunIKxv8VMXbT4CcWGbMUNlnXGvv4l7g4Id799mPtYF+lNiBubYp+WTQ== X-Gm-Gg: ASbGnctjDGJSKkLkIgRdJFSt/K/ALkLPiIZg5xOlzqy5lAMzEVm++iXrxtuIBlYakZU 2o9WMmPabfMSppRuxtUXt4VBS/rMfZVYLBihG5imGUsyOXqMi7WwclTiMO3ECqhON584FqVX3ir nRLRNFnIbkwFZqnPbnB7f5t9d4DNVaS3G23fC5pNNNkuE5mRzserOmR3ztT7CpEm7fqZSCQjZVY N6OkLme7l6X2R87WHGvW1otqSW+VpJoaRdLwYzptwZLKDcn22M22U1cigCornWgt1DZKfTYKAFx GCdssyP2jLiksBrsKgCActD8mQKGiFFWiLm1rCV3v01LVsE= X-Google-Smtp-Source: AGHT+IG7+aagMk/7mASdFSsdyiElTdd5y5F5VpT093hfEsE1SL9zPwPipbCgsB/WiLkpgjLPxut/5A== X-Received: by 2002:a05:6e02:483:b0:3ce:3c8a:b7d9 with SMTP id e9e14a558f8ab-3ce3c8ab91dmr20044075ab.18.1736359941044; Wed, 08 Jan 2025 10:12:21 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e68bf67530sm10657264173.47.2025.01.08.10.12.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2025 10:12:20 -0800 (PST) Date: Wed, 8 Jan 2025 12:12:19 -0600 From: Nathan Bossart To: pgsql-hackers@postgresql.org Cc: dipiets@amazon.com Subject: Re: use a non-locking initial test in TAS_SPIN on AArch64 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 Tue, Oct 22, 2024 at 02:54:57PM -0500, Nathan Bossart wrote: > My colleague Salvatore Dipietro (CC'd) sent me a couple of profiles that > showed an enormous amount of s_lock() time going to the > __sync_lock_test_and_set() call in the AArch64 implementation of tas(). > Upon closer inspection, I noticed that we don't implement a custom > TAS_SPIN() for this architecture, so I quickly hacked together the attached > patch and ran a couple of benchmarks that stressed the spinlock code. I > found no discussion about TAS_SPIN() on ARM in the archives, but I did > notice that the initial AArch64 support was added [0] before x86_64 started > using a non-locking test [1]. > > These benchmarks are for a c8g.24xlarge running a select-only pgbench with > 256 clients and pg_stat_statements.track_planning enabled. > > without the patch: > > [...] > > tps = 74135.100891 (without initial connection time) > > with the patch: > > [...] > > tps = 549462.785554 (without initial connection time) Are there any objections to proceeding with this change? So far, it's been tested on a c8g.24xlarge and an Apple M3 (which seems to be too small to show any effect). If anyone has access to a larger ARM machine, additional testing would be greatly appreciated. I think it would be unfortunate if this slipped to v19. -- nathan