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 1rhH0b-00AYnC-HV for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Mar 2024 22:42:09 +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 1rhH0Y-00BO2K-Vt for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Mar 2024 22:42:07 +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 1rhH0Y-00BO2C-Mi for pgsql-hackers@lists.postgresql.org; Mon, 04 Mar 2024 22:42:07 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rhH0V-002rw1-KA for pgsql-hackers@lists.postgresql.org; Mon, 04 Mar 2024 22:42:05 +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 424MfwdH3898619; Mon, 4 Mar 2024 17:41:59 -0500 From: Tom Lane To: Alvaro Herrera cc: Kyotaro Horiguchi , x4mmm@yandex-team.ru, dilipbalaut@gmail.com, tndrwang@gmail.com, pgsql-hackers@lists.postgresql.org, tomas.vondra@enterprisedb.com Subject: Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock In-reply-to: <3885480.1709590472@sss.pgh.pa.us> References: <202403031358.b435eh7u72td@alvherre.pgsql> <3885480.1709590472@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Mon, 04 Mar 2024 17:14:32 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <3898617.1709592118.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Mon, 04 Mar 2024 17:41:58 -0500 Message-ID: <3898618.1709592118@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > It looks like SLRU_PAGE_EMPTY has (by chance, or deliberately) > the numeric value of zero, so I guess the majority of our BF > animals are understanding this as "address != NULL". But that > doesn't look like a useful test to be making. In hopes of noticing whether there are other similar thinkos, I permuted the order of the SlruPageStatus enum values, and now I get the expected warnings from gcc: In file included from ../../../../src/include/postgres.h:45, from slru.c:59: slru.c: In function ‘SimpleLruWaitIO’: slru.c:436:38: warning: comparison between pointer and integer Assert(&shared->page_status[slotno] != SLRU_PAGE_EMPTY); ^~ ../../../../src/include/c.h:862:9: note: in definition of macro ‘Assert’ if (!(condition)) \ ^~~~~~~~~ slru.c: In function ‘SimpleLruWritePage’: slru.c:717:43: warning: comparison between pointer and integer Assert(&ctl->shared->page_status[slotno] != SLRU_PAGE_EMPTY); ^~ ../../../../src/include/c.h:862:9: note: in definition of macro ‘Assert’ if (!(condition)) \ ^~~~~~~~~ So it looks like it's just these two places. regards, tom lane