From: Fengguang Wu Date: Wed, 17 Oct 2007 06:30:45 +0000 (-0700) Subject: writeback: remove unnecessary wait in throttle_vm_writeout() X-Git-Tag: v2.6.24-rc1~563 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=369f2389e7d03022abdd25e298bffb9613cd0e54;p=linux-2.6-omap-h63xx.git writeback: remove unnecessary wait in throttle_vm_writeout() We don't want to introduce pointless delays in throttle_vm_writeout() when the writeback limits are not yet exceeded, do we? Cc: Nick Piggin Cc: OGAWA Hirofumi Cc: Kumar Gala Cc: Pete Zaitcev Cc: Greg KH Reviewed-by: Rik van Riel Signed-off-by: Fengguang Wu Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/page-writeback.c b/mm/page-writeback.c index d8c21e5a1bc..7845462064f 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -502,16 +502,6 @@ void throttle_vm_writeout(gfp_t gfp_mask) long background_thresh; long dirty_thresh; - if ((gfp_mask & (__GFP_FS|__GFP_IO)) != (__GFP_FS|__GFP_IO)) { - /* - * The caller might hold locks which can prevent IO completion - * or progress in the filesystem. So we cannot just sit here - * waiting for IO to complete. - */ - congestion_wait(WRITE, HZ/10); - return; - } - for ( ; ; ) { get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL); @@ -525,6 +515,14 @@ void throttle_vm_writeout(gfp_t gfp_mask) global_page_state(NR_WRITEBACK) <= dirty_thresh) break; congestion_wait(WRITE, HZ/10); + + /* + * The caller might hold locks which can prevent IO completion + * or progress in the filesystem. So we cannot just sit here + * waiting for IO to complete. + */ + if ((gfp_mask & (__GFP_FS|__GFP_IO)) != (__GFP_FS|__GFP_IO)) + break; } }