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 1rADWL-005T80-59 for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Dec 2023 18:18:17 +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 1rADWJ-000iXU-Kn for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Dec 2023 18:18:15 +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 1rADWJ-000iXM-B1 for pgsql-hackers@lists.postgresql.org; Mon, 04 Dec 2023 18:18:15 +0000 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rADWC-008n3W-6t for pgsql-hackers@postgresql.org; Mon, 04 Dec 2023 18:18:13 +0000 Received: by mail-il1-x136.google.com with SMTP id e9e14a558f8ab-35d591f0ea5so13097645ab.1 for ; Mon, 04 Dec 2023 10:18:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701713887; x=1702318687; 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=JZhZsxOzq7JBW2/D+5nV1DofuOGKtapXD6xFtiM9O4g=; b=XM1COsNf1/BaMkU9ZII7+CxotVkFVbC11QRBvzCcUimz+xbG7FLZY4RhEq+gIzN9Y2 5EFtR8JZTK1oDFVyTQEEIRVlmq6hJ0Ok5TmYweeRCj+uHhm0ADE3aUgHN0EVlL6RmTez rLng1pN0rEgZTaw0N/R42Ersqp9WmprBCjdTJgsS02chc4SGAy5uWCtSpvPIfGK0Lgc9 UCjLU1Vy5smOqO37vyEi0GTehzCZUkMNqyFDdXOC+QKeP/NQKKrH5WSh1NOfqkcEhEMN kuUpGLIbq9xwCzmc+mlhFLMeQPmmO7HirswxBi0DwbQ4LAkCBLcI2M0COf282DQaazL2 2+Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701713887; x=1702318687; 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=JZhZsxOzq7JBW2/D+5nV1DofuOGKtapXD6xFtiM9O4g=; b=H6GqLKPaxeKbASyM0cYq2iSKYEaaNbjgDcLckRG1QuqwCwchnmtI6jQfF8r2yFLjnQ 8R/FxcDzGa0bNyVIB6Uu9kqI/0Tb5N9rpn27c36maBKAypVU0AQI+WV2uo4eqdmPBNKb 78XQt5yvEbhaNur+4Ch3ebqXTtf+PAqYG6maMKX+c/vL7vo7qL/qm+xQrnqkAWHRn47v Jj2kR4mCD/Ym1pbbi50MLYifHcBpiath7YB8soGIDx4SnhnnjhHwcxwNF8IDgq2R/jfm uYCrsMBztjrM8/HPPAdAS13O6A5JImm2QjEzIDhM6nCogxf9kQdEriBYzCeL6p7RXJ0G TZvA== X-Gm-Message-State: AOJu0YwDaOtK6LtDW1Qs8zMAx5cb3744le4yRd+EkzPZF5of+5aFOJai T7uV9kQXmb/3U4KEoMvDiAx9GQeteKE= X-Google-Smtp-Source: AGHT+IH8unVUJ6bRKM9Ai649T1m8vwaZje5zh8+Jeqb/WA9M1d35+KRK+2knLjGicbGjQFIMfAwkQQ== X-Received: by 2002:a92:520c:0:b0:35d:59a2:1279 with SMTP id g12-20020a92520c000000b0035d59a21279mr6964905ilb.37.1701713887483; Mon, 04 Dec 2023 10:18:07 -0800 (PST) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id cz9-20020a0566384a0900b0046400df8ceasm2675919jab.170.2023.12.04.10.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 10:18:07 -0800 (PST) Date: Mon, 4 Dec 2023 12:18:05 -0600 From: Nathan Bossart To: Andres Freund Cc: pgsql-hackers@postgresql.org Subject: Re: optimize atomic exchanges Message-ID: <20231204181805.GA2148732@nathanxps13> References: <20231129212905.GA1258737@nathanxps13> <20231201031815.GA1519459@nathanxps13> <20231201035627.7xke2qvec6p5lihy@awork3.anarazel.de> <20231201043522.GB1577008@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231201043522.GB1577008@nathanxps13> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Nov 30, 2023 at 10:35:22PM -0600, Nathan Bossart wrote: > One thing on my mind is whether we should bother with the inline assembly > versions. It looks like gcc has had __atomic since 4.7.0 (2012), so I'm > not sure we gain much from them. OTOH they are pretty simple and seem > unlikely to cause too much trouble. Barring objections or additional feedback, I think I'm inclined to press forward with this one and commit it in the next week or two. I'm currently planning to keep the inline assembly, but I'm considering removing the configuration checks for __atomic_exchange_n() if the availability of __atomic_compare_exchange_n() seems like a reliable indicator of its presence. Thoughts? -- Nathan Bossart Amazon Web Services: https://aws.amazon.com