[PATCH 24/47] writeback: increase pause time on concurrent dirtiers

Wu Fengguang
2010-12-13T06:57:35Z

[-- Attachment #1: writeback-200ms-pause-time.patch --]
[-- Type: text/plain, Size: 1660 bytes --]

Increase max pause time to 200ms, and make it work for (HZ < 5).

The larger 200ms will help reduce overheads in server workloads with
lots of concurrent dirtier tasks.

CC: Dave Chinner <david@fromorbit.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
mm/page-writeback.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

--- linux-next.orig/mm/page-writeback.c 2010-12-09 11:52:05.000000000 +0800
+++ linux-next/mm/page-writeback.c 2010-12-09 11:54:05.000000000 +0800
@@ -36,6 +36,11 @@
#include <linux/pagevec.h>
#include <trace/events/writeback.h>

+/*
+ * Don't sleep more than 200ms at a time in balance_dirty_pages().
+ */
+#define MAX_PAUSE max(HZ/5, 1)
+
/* The following parameters are exported via /proc/sys/vm */

/*
@@ -660,7 +665,7 @@ static void balance_dirty_pages(struct a
bdi_update_bandwidth(bdi, start_time, bdi_dirty, bdi_thresh);

if (bdi_dirty >= task_thresh) {
- pause = HZ/10;
+ pause = MAX_PAUSE;
goto pause;
}

@@ -679,7 +684,7 @@ static void balance_dirty_pages(struct a
do_div(bw, bdi_thresh / TASK_SOFT_DIRTY_LIMIT + 1);

pause = HZ * pages_dirtied / ((unsigned long)bw + 1);
- pause = clamp_val(pause, 1, HZ/10);
+ pause = clamp_val(pause, 1, MAX_PAUSE);

pause:
trace_balance_dirty_pages(bdi,
@@ -714,7 +719,7 @@ pause:
current->nr_dirtied_pause = ratelimit_pages(bdi);
else if (pause == 1)
current->nr_dirtied_pause += current->nr_dirtied_pause / 32 + 1;
- else if (pause >= HZ/10)
+ else if (pause >= MAX_PAUSE)
/*
* when repeated, writing 1 page per 100ms on slow devices,
* i-(i+2)/4 will be able to reach 1 but never reduce to 0.