Re: BGWriter latch, power saving - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: BGWriter latch, power saving
Date
Msg-id 4F155A75.1090309@enterprisedb.com
Whole thread Raw
In response to Re: BGWriter latch, power saving  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: BGWriter latch, power saving  (Peter Geoghegan <peter@2ndquadrant.com>)
List 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.linnakangas@enterprisedb.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


pgsql-hackers by date:

Previous
From: Joel Jacobson
Date:
Subject: Re: Generate call graphs in run-time
Next
From: Pavel Stehule
Date:
Subject: review: psql tab completion for GRANT role