[PATCH 3/3] vm: writeout watermarks

From: Nick Piggin
Date: Tue Nov 01 2005 - 00:19:27 EST


3/3

--
SUSE Labs, Novell Inc.

Slightly change the writeout watermark calculations so we keep background
and synchronous writeout watermarks in the same ratios after adjusting them.
This ensures we should always attempt to start background writeout before
synchronous writeout.

Signed-off-by: Nick Piggin <npiggin@xxxxxxx>


Index: linux-2.6/mm/page-writeback.c
===================================================================
--- linux-2.6.orig/mm/page-writeback.c 2005-11-01 13:41:39.000000000 +1100
+++ linux-2.6/mm/page-writeback.c 2005-11-01 14:29:27.000000000 +1100
@@ -165,9 +165,11 @@ get_dirty_limits(struct writeback_state
if (dirty_ratio < 5)
dirty_ratio = 5;

- background_ratio = dirty_background_ratio;
- if (background_ratio >= dirty_ratio)
- background_ratio = dirty_ratio / 2;
+ /*
+ * Keep the ratio between dirty_ratio and background_ratio roughly
+ * what the sysctls are after dirty_ratio has been scaled (above).
+ */
+ background_ratio = dirty_background_ratio * dirty_ratio/vm_dirty_ratio;

background = (background_ratio * available_memory) / 100;
dirty = (dirty_ratio * available_memory) / 100;