Check background work whenever the flusher thread wakes up. The page reclaim code may lower the soft dirty limit immediately before sending some work to the flusher thread. This is also the prerequisite of next patch. Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx> --- fs/fs-writeback.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) --- linux-next.orig/fs/fs-writeback.c 2010-09-13 19:41:21.000000000 +0800 +++ linux-next/fs/fs-writeback.c 2010-09-13 19:49:11.000000000 +0800 @@ -716,6 +716,23 @@ get_next_work_item(struct backing_dev_in return work; } +static long wb_check_background_flush(struct bdi_writeback *wb) +{ + if (over_bground_thresh()) { + + struct wb_writeback_work work = { + .nr_pages = LONG_MAX, + .sync_mode = WB_SYNC_NONE, + .for_background = 1, + .range_cyclic = 1, + }; + + return wb_writeback(wb, &work); + } + + return 0; +} + static long wb_check_old_data_flush(struct bdi_writeback *wb) { unsigned long expired; @@ -787,6 +804,7 @@ long wb_do_writeback(struct bdi_writebac * Check for periodic writeback, kupdated() style */ wrote += wb_check_old_data_flush(wb); + wrote += wb_check_background_flush(wb); clear_bit(BDI_writeback_running, &wb->bdi->state); return wrote; -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>