[PATCH 06/45] writeback: use larger ratelimit when dirty_exceeded

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When dirty_exceeded, use ratelimit = ratelimit_pages/8, allowing it to
scale up to 512KB for memory bounty systems. This is more efficient than
the original 8 pages, and won't risk exceeding the dirty limit too much.

Given the larger ratelimit value, we can safely ignore the low bound
check in sync_writeback_pages.

dirty_exceeded is more likely to be seen when there are multiple dirty
processes. In which case the lowered ratelimit will help reduce their
overall wait time (latency) in the throttled queue.

CC: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> 
CC: Richard Kennedy <richard@xxxxxxxxxxxxxxx>
Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
---
 mm/page-writeback.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

--- linux.orig/mm/page-writeback.c	2009-10-06 23:37:50.000000000 +0800
+++ linux/mm/page-writeback.c	2009-10-06 23:38:18.000000000 +0800
@@ -39,7 +39,8 @@
  * After a CPU has dirtied this many pages, balance_dirty_pages_ratelimited
  * will look to see if it needs to force writeback or throttling.
  */
-static long ratelimit_pages = 32;
+#define MAX_RATELIMIT_PAGES ((4096 * 1024) / PAGE_CACHE_SIZE)
+static long ratelimit_pages = MAX_RATELIMIT_PAGES;
 
 /*
  * When balance_dirty_pages decides that the caller needs to perform some
@@ -49,9 +50,6 @@ static long ratelimit_pages = 32;
  */
 static inline long sync_writeback_pages(unsigned long dirtied)
 {
-	if (dirtied < ratelimit_pages)
-		dirtied = ratelimit_pages;
-
 	return dirtied + dirtied / 2;
 }
 
@@ -600,7 +598,7 @@ void balance_dirty_pages_ratelimited_nr(
 
 	ratelimit = ratelimit_pages;
 	if (mapping->backing_dev_info->dirty_exceeded)
-		ratelimit = 8;
+		ratelimit >>= 3;
 
 	/*
 	 * Check the rate limiting. Also, we do not want to throttle real-time
@@ -722,8 +720,8 @@ void writeback_set_ratelimit(void)
 	ratelimit_pages = vm_total_pages / (num_online_cpus() * 32);
 	if (ratelimit_pages < 16)
 		ratelimit_pages = 16;
-	if (ratelimit_pages * PAGE_CACHE_SIZE > 4096 * 1024)
-		ratelimit_pages = (4096 * 1024) / PAGE_CACHE_SIZE;
+	if (ratelimit_pages > MAX_RATELIMIT_PAGES)
+		ratelimit_pages = MAX_RATELIMIT_PAGES;
 }
 
 static int __cpuinit


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux