Re: BufFreelistLock - Mailing list pgsql-hackers

From Tom Lane
Subject Re: BufFreelistLock
Date
Msg-id 25070.1291999780@sss.pgh.pa.us
Whole thread Raw
In response to Re: BufFreelistLock  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: BufFreelistLock  (Jim Nasby <jim@nasby.net>)
List pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.com> writes:
> Excerpts from Jeff Janes's message of vie dic 10 12:24:34 -0300 2010:
>> As far as I can tell, bgwriter never adds things to the freelist.
>> That is only done at start up, and when a relation or a database is
>> dropped.  The clock sweep does the vast majority of the work.

> AFAIU bgwriter runs the clock sweep most of the time (BgBufferSync).

I think bgwriter just tries to write out dirty buffers so they'll be
clean when the clock sweep reaches them.  It doesn't try to move them to
the freelist.  There might be some advantage in having it move buffers
to a freelist that's just protected by a simple spinlock (or at least,
a lock different from the one that protects the clock sweep).  The
idea would be that most of the time, backends just need to lock the
freelist for long enough to take a buffer off it, and don't run clock
sweep at all.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Dmitriy Igrishin
Date:
Subject: Re: Fwd: Extended query protocol and exact types matches.
Next
From: "Kevin Grittner"
Date:
Subject: Re: Fwd: Extended query protocol and exact types matches.