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 1rSuJg-00Gi0J-Q6 for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jan 2024 07:38:29 +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 1rSuJf-00DeQy-D7 for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jan 2024 07:38:27 +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 1rSuJf-00DeLS-2x for pgsql-hackers@lists.postgresql.org; Thu, 25 Jan 2024 07:38:27 +0000 Received: from m12.mail.163.com ([220.181.12.215]) by makus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rSuJZ-003GMY-MF for pgsql-hackers@lists.postgresql.org; Thu, 25 Jan 2024 07:38:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=eaFrPdPWqhE8dkx5uyw/J/Un9oIMi+HnfbFX2cWv8wY=; b=qVaMEXt5M52fD9Rx8A542YvP3GkW+J9pjkxgexfsyp04b+5XOWR/LYX5N3jR9g nyyFyY82RD2lTuduMvmqnIpKviU+pNCMvQ2opySnYUwpm+Z4Dp9As4RULUeqM350 vD69iHFM73hWwD6FaFEQ7sAWG4dreJVX7oCLvBaF/88xw= Received: from b97369165980 (unknown [140.205.118.215]) by zwqz-smtp-mta-g0-4 (Coremail) with SMTP id _____wDnl6bkD7JlG4yqBw--.52534S3; Thu, 25 Jan 2024 15:38:12 +0800 (CST) References: <87o7dum084.fsf@163.com> <87h6jkmucz.fsf@163.com> <8734uz17va.fsf@163.com> <87o7diyf3z.fsf@163.com> <87edeexznn.fsf@163.com> <20240123200704.icmkv2vromua2dtj@awork3.anarazel.de> User-agent: mu4e 1.10.7; emacs 29.1 From: Andy Fan To: Andres Freund Cc: Robert Haas , Matthias van de Meent , Tom Lane , Thomas Munro , pgsql-hackers@lists.postgresql.org Subject: Re: the s_lock_stuck on perform_spin_delay Date: Thu, 25 Jan 2024 15:36:41 +0800 In-reply-to: <20240123200704.icmkv2vromua2dtj@awork3.anarazel.de> Message-ID: <87il3hvp5n.fsf@163.com> MIME-Version: 1.0 Content-Type: text/plain X-CM-TRANSID: _____wDnl6bkD7JlG4yqBw--.52534S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrKF4xtFyDXr17Kr4ftFy5Arb_yoW3tFc_XF yDCFyDGw45GFWYkas2kw15CF9rKayFyr1xX3yUJw4a9345AFZ8Xa1DXF1fZw1UJa4Yy3Zx uF1F9a409wsF9jkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRi_MaDUUUUU== X-Originating-IP: [140.205.118.215] X-CM-SenderInfo: x2klx3xlid0iqsrtqiywtou0bp/1tbiQAZwU2VOBOqL4QAAsK List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > On 2024-01-18 14:00:58 -0500, Robert Haas wrote: >> > The LockBufHdr also used init_local_spin_delay / perform_spin_delay >> > infrastruce and then it has the same issue like ${subject}, it is pretty >> > like the code in s_lock; Based on my current knowledge, I think we >> > should add the check there. >> >> I'd like to hear from Andres, if possible. @Andres: Should these >> sanity checks apply only to spin locks per se, or also to buffer >> header locks? > > They also should apply to buffer header locks. The exact same dangers apply > there. The only reason this isn't using a plain spinlock is that this way we > can modify more state with a single atomic operation. But all the dangers of > using spinlocks apply just as well. Thanks for speaking on this! -- Best Regards Andy Fan