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 1r1SfG-00BIMx-U1 for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Nov 2023 14:39:18 +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 1r1SfD-0042fg-IK for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Nov 2023 14:39: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 1r1SfD-0042fV-5k for pgsql-hackers@lists.postgresql.org; Fri, 10 Nov 2023 14:39:15 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1r1SfA-004v68-MU for pgsql-hackers@lists.postgresql.org; Fri, 10 Nov 2023 14:39:13 +0000 Received: by mail-pf1-x443.google.com with SMTP id d2e1a72fcca58-6bcef66f9caso149951b3a.0 for ; Fri, 10 Nov 2023 06:39:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699627151; x=1700231951; darn=lists.postgresql.org; h=message-id:in-reply-to:to:references:date:subject:mime-version:from :from:to:cc:subject:date:message-id:reply-to; bh=UwxnB+oQ0B2qoqPGBRwHaPrqQW91CfN5qgTwhHUI9wI=; b=T3ETZIAS55TcmksUSQ+Rux/EuQpaS/dd1khCJS5pKrMyD5C3ifuxIRdP5h8VbgB9wf ZaSHOTuGn83V8at1AxiOjkZQkSiD1ew3KegWx1mGfx3fZqIVVAkzLFkmWCVLoUWcLwc6 7Ii4eYUIgpwOsJu1BL2BFfsSzLNS8Ln5X2Q2890rRuaXsz8I02ZhlHWO1E1CniER3k3q efkdxQbosmMkmBQvOboC962lSx70qcXqsDrEBTjWh1ChlP95A6j5ew5rbCF2O36Ppgxc Ab+zoFzBw1zXxoHVF6OPc3bS5+a6QCkeDgMSU7y4KmfdrvhpdqPKY6uPNwXu03bin2tG IaoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699627151; x=1700231951; h=message-id:in-reply-to:to:references:date:subject:mime-version:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UwxnB+oQ0B2qoqPGBRwHaPrqQW91CfN5qgTwhHUI9wI=; b=TXdu1r5FixkxbTfsw1Y+ghzzgFKDb9Q47xvTAjgsVCQnT2l8LAuUrAqEize/Sp63P/ 5zYVdXJpIJyilAKw62P1A3ubly4CnW8NrvSAIx7q/f71JHXvAXHpil5We2W95UK9J+FB joe92x3SZl67crLzjF96zpZhiwxl8LDmnimykEfmGzXHai2/sRLQOEGroMjT7tz54QNl O5bncs+zixVUiERxT9emZy/92JlhCrgOp1ecQMulLoqh/e7rxQ8+OHpKHs6LqZPc6JwH HZmzJ3+8kouim1mUhknfnNBkKHvSzHRPj/0wfRcVHKx0GXP7W7HtBtpwUF59foPw3Xzt iXTg== X-Gm-Message-State: AOJu0YyHS4zObZ519sNgly5QOP/smWBcw9Vw08G4igTTpTnGQM4turD2 DcxisItpviSyKBnxdv048WTv1QFeRogclNNascQ= X-Google-Smtp-Source: AGHT+IFxqpHa+kT3Ki7fOekRyLc70+FxdPOV5d+ALW7KVh7jZGHkKWCIscsa7viHMUvOwv3ijY7nkA== X-Received: by 2002:aa7:8bdd:0:b0:6bf:1621:ccad with SMTP id s29-20020aa78bdd000000b006bf1621ccadmr8389426pfd.0.1699627151269; Fri, 10 Nov 2023 06:39:11 -0800 (PST) Received: from smtpclient.apple ([2406:da18:d69:3200:453e:4974:5cb8:8a68]) by smtp.gmail.com with ESMTPSA id r19-20020aa78b93000000b0069343e474bcsm12633469pfd.104.2023.11.10.06.39.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Nov 2023 06:39:11 -0800 (PST) From: jacktby jacktby Content-Type: multipart/alternative; boundary="Apple-Mail=_120D8671-5F2E-41E8-960C-090C0B9F6EF1" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Subject: Re: Buffer Cache Problem Date: Fri, 10 Nov 2023 22:38:57 +0800 References: <059DE243-F4B0-41CC-84BE-9362FC5FB99A@gmail.com> To: pgsql-hackers@lists.postgresql.org In-Reply-To: Message-Id: <8ADBC847-2D66-4EFB-89AF-76338B8B46F4@gmail.com> X-Mailer: Apple Mail (2.3731.600.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_120D8671-5F2E-41E8-960C-090C0B9F6EF1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > 2023=E5=B9=B411=E6=9C=8810=E6=97=A5 22:31=EF=BC=8Cjacktby jacktby = =E5=86=99=E9=81=93=EF=BC=9A >=20 > In the bus_internal.h,I see > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > Note: Buffer header lock (BM_LOCKED flag) must be held to examine or = change tag, state or wait_backend_pgprocno fields. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > As we all know, this buffer header lock is implemented by a bit in = state filed, and this state field is a atomic_u32 type, so in fact we = don=E2=80=99t need to=20 > hold buffer lock when we update state, this comment has error=EF=BC=8Cri= ght? Oh, sorry this is true, in fact we never acquire a spin lock when update = the state.= --Apple-Mail=_120D8671-5F2E-41E8-960C-090C0B9F6EF1 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
2023=E5=B9=B411=E6=9C=8810=E6=97=A5 22:31=EF=BC=8Cjackt= by jacktby <jacktby@gmail.com> =E5=86=99=E9=81=93=EF=BC=9A

In = the bus_internal.h,I see
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 Note: = Buffer header lock (BM_LOCKED flag) must be held to examine or change =  tag, state or wait_backend_pgprocno = fields.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
As = we all know, this buffer header lock is implemented by a bit in state = filed, and this state field is a atomic_u32 type, so in fact we don=E2=80=99= t need to 
hold buffer lock when we update = state, this comment has = error=EF=BC=8Cright?
Oh, = sorry this is true, in fact we never acquire a spin lock when update the = state.= --Apple-Mail=_120D8671-5F2E-41E8-960C-090C0B9F6EF1--