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 1jgvJ7-00021T-2l for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jun 2020 19:13:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jgvJ4-0001Ym-HV for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jun 2020 19:13:38 +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 1jgvJ4-0001Yf-BH for pgsql-hackers@lists.postgresql.org; Thu, 04 Jun 2020 19:13:38 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jgvIy-0003B3-6M for pgsql-hackers@lists.postgresql.org; Thu, 04 Jun 2020 19:13:37 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 054JDTiF1257110; Thu, 4 Jun 2020 15:13:29 -0400 From: Tom Lane To: Andres Freund cc: pgsql-hackers@lists.postgresql.org Subject: Re: Atomic operations within spinlocks In-reply-to: <20200604190645.xumymtlefvqgdhfr@alap3.anarazel.de> References: <1141819.1591208385@sss.pgh.pa.us> <20200603204542.reuladbmgmjqzoi6@alap3.anarazel.de> <1253593.1591293439@sss.pgh.pa.us> <1256132.1591296640@sss.pgh.pa.us> <20200604190645.xumymtlefvqgdhfr@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Thu, 04 Jun 2020 12:06:45 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1257108.1591298009.1@sss.pgh.pa.us> Date: Thu, 04 Jun 2020 15:13:29 -0400 Message-ID: <1257109.1591298009@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2020-06-04 14:50:40 -0400, Tom Lane wrote: >> 2. The computed completePasses value would go backwards. I bet >> that wouldn't matter too much either, or at least we could teach >> BgBufferSync to cope. (I notice the comments therein suggest that >> it is already designed to cope with completePasses wrapping around, >> so maybe nothing needs to be done.) > If we're not concerned about that, then we can remove the > atomic-inside-spinlock, I think. The only reason for that right now is > to avoid assuming a wrong pass number. Hmm. That might be a less-invasive path to a solution. I can take a look, if you don't want to. regards, tom lane