Skip site navigation (1) Skip section navigation (2)

Re: BGWriter latch, power saving

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BGWriter latch, power saving
Date: 2012-01-17 11:24:37
Message-ID: 4F155A75.1090309@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On 17.01.2012 12:16, Heikki Linnakangas wrote:
> On 04.01.2012 17:05, Peter Geoghegan wrote:
>> On 4 January 2012 07:24, Heikki Linnakangas
>> <heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
>>> I think SetBufferCommitInfoNeedsSave() needs the same treatment as
>>> MarkBufferDirty(). And it would probably be good to only set the
>>> latch if
>>> the buffer wasn't dirty already. Setting a latch that's already set
>>> is fast,
>>> but surely it's even faster to not even try.
>>
>> That seems reasonable. Revised patch is attached.
>
> Thanks! It occurs to me that it's still a bad idea to call SetLatch()
> while holding the buffer header spinlock. At least when it's trivial to
> just move the call after releasing the lock. See attached.
>
> Could you do the sleeping/hibernating logic all in BgWriterNap()?

(sorry, forgot to update the above question before sending..)

In the patch I sent, I did rearrange the sleeping logic. I think it's 
more readable the way it is now.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

In response to

Responses

pgsql-hackers by date

Next:From: Pavel StehuleDate: 2012-01-17 12:03:50
Subject: review: psql tab completion for GRANT role
Previous:From: Fujii MasaoDate: 2012-01-17 10:38:23
Subject: Re: Online base backup from the hot-standby

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group