Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b2h3g-0000oz-AP for pgsql-hackers@arkaria.postgresql.org; Tue, 17 May 2016 15:37:20 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b2h3f-0004cG-Tf for pgsql-hackers@arkaria.postgresql.org; Tue, 17 May 2016 15:37:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b2h2I-0001vq-JA for pgsql-hackers@postgresql.org; Tue, 17 May 2016 15:35:54 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b2h2F-0002YE-0D for pgsql-hackers@postgresql.org; Tue, 17 May 2016 15:35:54 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u4HFZkr1025422; Tue, 17 May 2016 11:35:47 -0400 From: Tom Lane To: Teodor Sigaev cc: Michael Paquier , PostgreSQL mailing lists Subject: Re: Re: [COMMITTERS] pgsql: Correctly align page's images in generic wal API In-reply-to: <573A450D.6090607@sigaev.ru> References: <573A450D.6090607@sigaev.ru> Comments: In-reply-to Teodor Sigaev message dated "Tue, 17 May 2016 01:09:17 +0300" Date: Tue, 17 May 2016 11:35:46 -0400 Message-ID: <1146.1463499346@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Teodor Sigaev writes: >> Instead of allocating this memory unconditionally for each buffer, >> wouldn't it be better to set all the page pointers to NULL in >> GenericXLogStart and allocate memory only once a buffer is registered >> in GenericXLogRegisterBuffer when finding a free slot? This patch is >> wasting many cycles. > GenericXLogRegisterBuffer() could be called in another MemoryContext what > can be a reason for strange bugs. Right now only a few pages could be > involved in one round of GenericWal. I don't believe that such allocation > could be a reason of noticable performance degradation. Although I didn't > check that. You could allocate all the pages in one palloc, though, and then just set the pointers via address arithmetic. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers