]> git.hungrycats.org Git - linux/commitdiff
[PATCH] reduced context switch rate in writeback
authorAndrew Morton <akpm@digeo.com>
Tue, 26 Nov 2002 01:57:03 +0000 (17:57 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 26 Nov 2002 01:57:03 +0000 (17:57 -0800)
pdflush writes back chunks of ~1000 pages.  It currently takes a short
nap if it writes back no pages at all.  That could cause it to write
back lots of small batches of pages, as it bounces against a congested
queue.

Change it to sleep if it failed to write back the entire batch against
a congested queue.  Ths reduces the context switch rate a little.

The context switch rate is still fairly high (150/sec) - this appears
to be due to add_disk_randomness() scheduling a work function.

mm/page-writeback.c

index 91b16e7ea36061a911db8d80c83a85c661bb1f74..28826c71230992bc15aab5f92e0c940b304bfbf1 100644 (file)
@@ -229,8 +229,8 @@ static void background_writeout(unsigned long _min_pages)
                wbc.nr_to_write = MAX_WRITEBACK_PAGES;
                writeback_inodes(&wbc);
                min_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write;
-               if (wbc.nr_to_write == MAX_WRITEBACK_PAGES) {
-                       /* Wrote nothing */
+               if (wbc.nr_to_write > 0) {
+                       /* Wrote less than expected */
                        if (wbc.encountered_congestion)
                                blk_congestion_wait(WRITE, HZ/10);
                        else