]> granicus.if.org Git - postgresql/commit
Make bgwriter sleep longer when it has no work to do, to save electricity.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 26 Jan 2012 16:19:48 +0000 (18:19 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 26 Jan 2012 16:39:13 +0000 (18:39 +0200)
commit6d90eaaa89a007e0d365f49d6436f35d2392cfeb
tree625c4dc75f0067c438696b9ebc96715521635e2f
parent467ff207f51439cadee7857d6a0874f34652ed53
Make bgwriter sleep longer when it has no work to do, to save electricity.

To make it wake up promptly when activity starts again, backends nudge it
by setting a latch in MarkBufferDirty(). The latch is kept set while
bgwriter is active, so there is very little overhead from that when the
system is busy. It is only armed before going into longer sleep.

Peter Geoghegan, with some changes by me.
src/backend/postmaster/bgwriter.c
src/backend/storage/buffer/bufmgr.c
src/include/storage/bufmgr.h
src/include/storage/proc.h