Re: [PATCH 18/35] writeback: start background writeback earlier

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

 



On Mon, Dec 13, 2010 at 10:47:04PM +0800, Wu, Fengguang wrote:
> It's possible for some one to suddenly eat lots of memory,
> leading to sudden drop of global dirty limit. So a dirtier
> task may get hard throttled immediately without some previous
> balance_dirty_pages() call to invoke background writeback.
> 
> In this case we need to check for background writeback earlier in the
> loop to avoid stucking the application for very long time. This was not
> a problem before the IO-less balance_dirty_pages() because it will try
> to write something and then break out of the loop regardless of the
> global limit.
> 
> Another scheme this check will help is, the dirty limit is too close to
> the background threshold, so that someone manages to jump directly into
> the pause threshold (background+dirty)/2.
> 
> Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
> ---
>  mm/page-writeback.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> --- linux-next.orig/mm/page-writeback.c	2010-12-13 21:46:16.000000000 +0800
> +++ linux-next/mm/page-writeback.c	2010-12-13 21:46:17.000000000 +0800
> @@ -748,6 +748,9 @@ static void balance_dirty_pages(struct a
>  				    bdi_stat(bdi, BDI_WRITEBACK);
>  		}
>  
> +		if (unlikely(!writeback_in_progress(bdi)))
> +			bdi_start_background_writeback(bdi);
> +
>  		bdi_update_bandwidth(bdi, start_time, bdi_dirty, bdi_thresh);
>  
>  		/*
> 

The above patch allows this simplification.
---
Subject: writeback: start background writeback earlier - handle laptop mode
Date: Wed Dec 15 20:15:54 CST 2010

The laptop mode handling can be simplified since we've kick background
writeback inside the balance_dirty_pages() loop on dirty_exceeded.

Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
---
 mm/page-writeback.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- linux-next.orig/mm/page-writeback.c	2010-12-15 20:14:33.000000000 +0800
+++ linux-next/mm/page-writeback.c	2010-12-15 20:15:39.000000000 +0800
@@ -891,8 +891,10 @@ pause:
 	 * In normal mode, we start background writeout at the lower
 	 * background_thresh, to keep the amount of dirty memory low.
 	 */
-	if ((laptop_mode && dirty_exceeded) ||
-	    (!laptop_mode && (nr_reclaimable > background_thresh)))
+	if (laptop_mode)
+		return;
+
+	if (nr_reclaimable > background_thresh)
 		bdi_start_background_writeback(bdi);
 }
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]