Index: linux-2.6.19-rc6-mm1/mm/page-writeback.c =================================================================== --- linux-2.6.19-rc6-mm1.orig/mm/page-writeback.c 2006-11-27 19:15:16.000000000 -0800 +++ linux-2.6.19-rc6-mm1/mm/page-writeback.c 2006-11-27 19:21:22.000000000 -0800 @@ -105,6 +105,9 @@ struct dirty_limits { long background; long dirty; + unsigned long nr_dirty; + unsigned long nr_unstable; + unsigned long nr_writeback; }; /* @@ -169,6 +172,9 @@ } dl->background = background; dl->dirty = dirty; + dl->nr_dirty = global_page_state(NR_FILE_DIRTY); + dl->nr_unstable = global_page_state(NR_UNSTABLE_NFS); + dl->nr_writeback = global_page_state(NR_WRITEBACK); } /* @@ -197,9 +203,8 @@ }; get_dirty_limits(&dl, mapping); - nr_reclaimable = global_page_state(NR_FILE_DIRTY) + - global_page_state(NR_UNSTABLE_NFS); - if (nr_reclaimable + global_page_state(NR_WRITEBACK) <= + nr_reclaimable = dl.nr_dirty + dl.nr_unstable; + if (nr_reclaimable + dl.nr_writeback <= dl.dirty) break; @@ -215,11 +220,8 @@ if (nr_reclaimable) { writeback_inodes(&wbc); get_dirty_limits(&dl, mapping); - nr_reclaimable = global_page_state(NR_FILE_DIRTY) + - global_page_state(NR_UNSTABLE_NFS); - if (nr_reclaimable + - global_page_state(NR_WRITEBACK) - <= dl.dirty) + nr_reclaimable = dl.nr_dirty + dl.nr_unstable; + if (nr_reclaimable + dl.nr_writeback <= dl.dirty) break; pages_written += write_chunk - wbc.nr_to_write; if (pages_written >= write_chunk) @@ -228,7 +230,7 @@ congestion_wait(WRITE, HZ/10); } - if (nr_reclaimable + global_page_state(NR_WRITEBACK) + if (nr_reclaimable + dl.nr_writeback <= dl.dirty && dirty_exceeded) dirty_exceeded = 0; @@ -313,9 +315,8 @@ */ dl.dirty += dl.dirty / 10; /* wheeee... */ - if (global_page_state(NR_UNSTABLE_NFS) + - global_page_state(NR_WRITEBACK) <= dl.dirty) - break; + if (dl.nr_unstable + dl.nr_writeback <= dl.dirty) + break; congestion_wait(WRITE, HZ/10); } } @@ -341,8 +342,7 @@ struct dirty_limits dl; get_dirty_limits(&dl, NULL); - if (global_page_state(NR_FILE_DIRTY) + - global_page_state(NR_UNSTABLE_NFS) < dl.background + if (dl.nr_dirty + dl.nr_unstable < dl.background && min_pages <= 0) break; wbc.encountered_congestion = 0;