Thread: pgsql: Make bgwriter sleep longer when it has no work to do, to save el
pgsql: Make bgwriter sleep longer when it has no work to do, to save el
From
Heikki Linnakangas
Date:
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. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/6d90eaaa89a007e0d365f49d6436f35d2392cfeb Modified Files -------------- src/backend/postmaster/bgwriter.c | 144 +++++++++++++++++++++++++++++++---- src/backend/storage/buffer/bufmgr.c | 41 ++++++++--- src/include/storage/bufmgr.h | 2 +- src/include/storage/proc.h | 2 + 4 files changed, 163 insertions(+), 26 deletions(-)
Re: pgsql: Make bgwriter sleep longer when it has no work to do, to save el
From
Peter Geoghegan
Date:
On 26 January 2012 16:43, Heikki Linnakangas <heikki.linnakangas@iki.fi> wrote: > Make bgwriter sleep longer when it has no work to do, to save electricity. Perhaps this is pedantic, but shouldn't we be initialising bgwriterLatch to NULL within InitProcGlobal(), much as we already do for the other pointers in that structure? -- Peter Geoghegan http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training and Services
Re: pgsql: Make bgwriter sleep longer when it has no work to do, to save el
From
Heikki Linnakangas
Date:
On 27.01.2012 16:43, Peter Geoghegan wrote: > On 26 January 2012 16:43, Heikki Linnakangas<heikki.linnakangas@iki.fi> wrote: >> Make bgwriter sleep longer when it has no work to do, to save electricity. > > Perhaps this is pedantic, but shouldn't we be initialising > bgwriterLatch to NULL within InitProcGlobal(), much as we already do > for the other pointers in that structure? Yeah, it should. Fixed. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com