Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kCodo-0000EO-H2 for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2020 18:34:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kCodn-0005I0-Ft for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2020 18:34:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kCodn-0005Hr-8g for pgsql-hackers@lists.postgresql.org; Mon, 31 Aug 2020 18:34:51 +0000 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kCodl-0006ZP-2V for pgsql-hackers@lists.postgresql.org; Mon, 31 Aug 2020 18:34:50 +0000 Received: by mail-qt1-x842.google.com with SMTP id n18so5519694qtw.0 for ; Mon, 31 Aug 2020 11:34:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=9EX6jLQyAfNA0TfQ0q2duF4zzTnl5b2gEiPpzCi3Jpk=; b=JnkT8SGkpt/dV9YgVNZIugS7yOyLBgMj/J75pjdHjYVpxuD+qyuQicPQIz9ZN2hRhW wTJaNDP2YuLjZ6aZ3cjBFMvT45siVQCFx3xJkEa5laUC/dIHGjlBPtdbIE96+/5oGmXs 4uo8BRXxuTpi6rKL4d9RaTE/IjfRQggk6wPJPUpbJqzXfOkQSHk0xpdtySJet1uzWhgB IKiGQi3oyDhLOIxaKqcdIqv0rgxYAB5CJgaskB3YueQ9NdQq+Vzmwhzi0rPZCp441++a zXQE/d6ZbSVw7SPJpRZcEQfLPFS8X4DjGh8ZkL/gon5TG4GNCUliUEzEWZDf585C3M33 Z87w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=9EX6jLQyAfNA0TfQ0q2duF4zzTnl5b2gEiPpzCi3Jpk=; b=oLZxctdnr4hpYKVV0trV8AjTzvvw3v9jFBln4M7pyNdd+VieqPSQR98WonUaRUMKOM TfVMwL0sADhaBCJM6Ga6XGbliP4xzLpAFi/r/EyAZGckhn9ARgs1TGiMF4vV68FR+9Fi 3KiEa6t2IFgSaCbRPvAfvV/yUiR/moML0+aA5N51BpgmWnhe7UKTQpIDWsy30+zAYxyR m3ZKkIyGEZK32mBuNdlvTAs2iRJ2Qzwpnvpx0Onl691fewW3eeKDgl1uNwM4Id9e0BKa SwyDlOl6bQ+0boKolnb6Y0Dvca34tNaJktFE3dOl4yzqJXfszWoqtMAgG6MD70reYeT5 eFWg== X-Gm-Message-State: AOAM530A87tynv2C7+TFxL4uaxemn1yT2JF/+Oc2d1wsz4t693YwWosG SObh2+nw5GSrFryGZNOY+WjbhA== X-Google-Smtp-Source: ABdhPJzFmBaEU/0ky5I6ajFdy+7ycK19/ecH9wfzRhwpf2JdeIVk38JDyqCpOTmjr5vyjsAuVX2BqQ== X-Received: by 2002:ac8:1301:: with SMTP id e1mr2660936qtj.136.1598898888098; Mon, 31 Aug 2020 11:34:48 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.19.47]) by smtp.gmail.com with ESMTPSA id j74sm10811081qke.7.2020.08.31.11.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2020 11:34:47 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 036A22A0EF6; Mon, 31 Aug 2020 14:34:46 -0400 (-04) Date: Mon, 31 Aug 2020 14:34:45 -0400 From: Alvaro Herrera To: Andres Freund Cc: pgsql-hackers@lists.postgresql.org, Jaime Casanova Subject: Re: LogwrtResult contended spinlock Message-ID: <20200831183445.GA23447@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Aug-31, Andres Freund wrote: > Hi, > > On August 31, 2020 11:21:56 AM PDT, Alvaro Herrera wrote: > >At first I wanted to make the new LWLock cover only LogwrtResult > >proper, > >and leave LogwrtRqst alone. However on doing it, it seemed that that > >might change the locking protocol in a nontrivial way. So I decided to > >make it cover both and call it a day. We did verify that the patch > >solves the reported problem, at any rate. > > Wouldn't the better fix here be to allow reading of individual members > without a lock? E.g. by wrapping each in a 64bit atomic. Heh, Simon said the same. It's not clear to me due to the lack of general availability of 64-bit atomics. If they are spinlock-protected when emulated, I think that would make the problem worse. IIRC Thomas wanted to start relying on atomic 64-bit vars in some patch, but I don't remember what it was. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services