Re: [PATCH] writeback: remove the internal 5% low bound on dirty_ratio

Previous thread: divide by zero bug in find_busiest_group by Chetan Ahuja on Wednesday, August 25, 2010 - 6:17 pm. (7 messages)

Next thread: linux-next: Tree for August 26 by Stephen Rothwell on Wednesday, August 25, 2010 - 6:51 pm. (1 message)
From: Wu Fengguang
Date: Wednesday, August 25, 2010 - 6:29 pm

OK, the following patch gives users the full freedom. I tested 1
single dirtier and 9 parallel dirtiers, the system remains alive, but
with much slower IO throughput. Maybe not all users care IO performance
in all situations?

Thanks,
Fengguang
---
writeback: remove the internal 5% low bound on dirty_ratio

The dirty_ratio was silently limited in global_dirty_limits() to >= 5%.
This is not a user expected behavior. And it's inconsistent with
calc_period_shift(), which uses the plain vm_dirty_ratio value.

Let's rip the internal bound.

At the same time, fix balance_dirty_pages() to work with the
dirty_thresh=0 case. This allows applications to proceed when
dirty+writeback pages are all cleaned.

CC: Jan Kara <jack@suse.cz>
CC: Neil Brown <neilb@suse.de>
CC: Con Kolivas <kernel@kolivas.org>
CC: Rik van Riel <riel@redhat.com>
CC: Peter Zijlstra <a.p.zijlstra@chello.nl>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 mm/page-writeback.c |   14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

--- linux-next.orig/mm/page-writeback.c	2010-08-26 08:37:31.000000000 +0800
+++ linux-next/mm/page-writeback.c	2010-08-26 08:37:55.000000000 +0800
@@ -415,14 +415,8 @@ void global_dirty_limits(unsigned long *
 
 	if (vm_dirty_bytes)
 		dirty = DIV_ROUND_UP(vm_dirty_bytes, PAGE_SIZE);
-	else {
-		int dirty_ratio;
-
-		dirty_ratio = vm_dirty_ratio;
-		if (dirty_ratio < 5)
-			dirty_ratio = 5;
-		dirty = (dirty_ratio * available_memory) / 100;
-	}
+	else
+		dirty = (vm_dirty_ratio * available_memory) / 100;
 
 	if (dirty_background_bytes)
 		background = DIV_ROUND_UP(dirty_background_bytes, PAGE_SIZE);
@@ -542,8 +536,8 @@ static void balance_dirty_pages(struct a
 		 * the last resort safeguard.
 		 */
 		dirty_exceeded =
-			(bdi_nr_reclaimable + bdi_nr_writeback >= bdi_thresh)
-			|| (nr_reclaimable + nr_writeback >= dirty_thresh);
+			(bdi_nr_reclaimable + bdi_nr_writeback > ...
From: Neil Brown
Date: Wednesday, August 25, 2010 - 6:36 pm

On Thu, 26 Aug 2010 09:29:45 +0800

And ">" fits with the name "exceeded" better than ">=" does.  I think it is
an aesthetic improvement as well as a functional one.

Reviewed-by: NeilBrown <neilb@suse.de>

Thanks,

--

From: KOSAKI Motohiro
Date: Wednesday, August 25, 2010 - 9:22 pm

I agree :)
	Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>




--

Previous thread: divide by zero bug in find_busiest_group by Chetan Ahuja on Wednesday, August 25, 2010 - 6:17 pm. (7 messages)

Next thread: linux-next: Tree for August 26 by Stephen Rothwell on Wednesday, August 25, 2010 - 6:51 pm. (1 message)