linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: use global_dirty_limit in throttle_vm_writeout()
@ 2012-03-02  6:14 Fengguang Wu
  2012-03-05 20:06 ` Rik van Riel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Fengguang Wu @ 2012-03-02  6:14 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Johannes Weiner, Jan Kara, Greg Thelen, Ying Han,
	KAMEZAWA Hiroyuki, Rik van Riel, Mel Gorman, Minchan Kim,
	Linux Memory Management List, LKML

When starting a memory hog task, a desktop box w/o swap is found to go
unresponsive for a long time. It's solely caused by lots of congestion
waits in throttle_vm_writeout():

 gnome-system-mo-4201 553.073384: congestion_wait: throttle_vm_writeout+0x70/0x7f shrink_mem_cgroup_zone+0x48f/0x4a1
 gnome-system-mo-4201 553.073386: writeback_congestion_wait: usec_timeout=100000 usec_delayed=100000
           gtali-4237 553.080377: congestion_wait: throttle_vm_writeout+0x70/0x7f shrink_mem_cgroup_zone+0x48f/0x4a1
           gtali-4237 553.080378: writeback_congestion_wait: usec_timeout=100000 usec_delayed=100000
            Xorg-3483 553.103375: congestion_wait: throttle_vm_writeout+0x70/0x7f shrink_mem_cgroup_zone+0x48f/0x4a1
            Xorg-3483 553.103377: writeback_congestion_wait: usec_timeout=100000 usec_delayed=100000

The root cause is, the dirty threshold is knocked down a lot by the
memory hog task. Fixed by using global_dirty_limit which decreases
gradually on such events and can guarantee we stay above (the also
decreasing) nr_dirty in the progress of following down to the new
dirty threshold.

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
 mm/page-writeback.c |    1 +
 1 file changed, 1 insertion(+)

--- linux.orig/mm/page-writeback.c	2012-03-02 14:05:01.633763187 +0800
+++ linux/mm/page-writeback.c	2012-03-02 14:11:52.929772962 +0800
@@ -1472,6 +1472,7 @@ void throttle_vm_writeout(gfp_t gfp_mask
 
         for ( ; ; ) {
 		global_dirty_limits(&background_thresh, &dirty_thresh);
+		dirty_thresh = hard_dirty_limit(dirty_thresh);
 
                 /*
                  * Boost the allowable dirty threshold a bit for page

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: use global_dirty_limit in throttle_vm_writeout()
  2012-03-02  6:14 [PATCH] mm: use global_dirty_limit in throttle_vm_writeout() Fengguang Wu
@ 2012-03-05 20:06 ` Rik van Riel
  2012-03-19  7:37 ` Johannes Weiner
  2012-03-21  0:43 ` Minchan Kim
  2 siblings, 0 replies; 4+ messages in thread
From: Rik van Riel @ 2012-03-05 20:06 UTC (permalink / raw)
  To: Fengguang Wu
  Cc: Andrew Morton, Johannes Weiner, Jan Kara, Greg Thelen, Ying Han,
	KAMEZAWA Hiroyuki, Mel Gorman, Minchan Kim,
	Linux Memory Management List, LKML

On 03/02/2012 01:14 AM, Fengguang Wu wrote:
> When starting a memory hog task, a desktop box w/o swap is found to go
> unresponsive for a long time. It's solely caused by lots of congestion
> waits in throttle_vm_writeout():
>
>   gnome-system-mo-4201 553.073384: congestion_wait: throttle_vm_writeout+0x70/0x7f shrink_mem_cgroup_zone+0x48f/0x4a1
>   gnome-system-mo-4201 553.073386: writeback_congestion_wait: usec_timeout=100000 usec_delayed=100000
>             gtali-4237 553.080377: congestion_wait: throttle_vm_writeout+0x70/0x7f shrink_mem_cgroup_zone+0x48f/0x4a1
>             gtali-4237 553.080378: writeback_congestion_wait: usec_timeout=100000 usec_delayed=100000
>              Xorg-3483 553.103375: congestion_wait: throttle_vm_writeout+0x70/0x7f shrink_mem_cgroup_zone+0x48f/0x4a1
>              Xorg-3483 553.103377: writeback_congestion_wait: usec_timeout=100000 usec_delayed=100000
>
> The root cause is, the dirty threshold is knocked down a lot by the
> memory hog task. Fixed by using global_dirty_limit which decreases
> gradually on such events and can guarantee we stay above (the also
> decreasing) nr_dirty in the progress of following down to the new
> dirty threshold.
>
> Signed-off-by: Fengguang Wu<fengguang.wu@intel.com>

Reviewed-by: Rik van Riel <riel@redhat.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: use global_dirty_limit in throttle_vm_writeout()
  2012-03-02  6:14 [PATCH] mm: use global_dirty_limit in throttle_vm_writeout() Fengguang Wu
  2012-03-05 20:06 ` Rik van Riel
@ 2012-03-19  7:37 ` Johannes Weiner
  2012-03-21  0:43 ` Minchan Kim
  2 siblings, 0 replies; 4+ messages in thread
From: Johannes Weiner @ 2012-03-19  7:37 UTC (permalink / raw)
  To: Fengguang Wu
  Cc: Andrew Morton, Jan Kara, Greg Thelen, Ying Han,
	KAMEZAWA Hiroyuki, Rik van Riel, Mel Gorman, Minchan Kim,
	Linux Memory Management List, LKML

On Fri, Mar 02, 2012 at 02:14:51PM +0800, Fengguang Wu wrote:
> When starting a memory hog task, a desktop box w/o swap is found to go
> unresponsive for a long time. It's solely caused by lots of congestion
> waits in throttle_vm_writeout():
> 
>  gnome-system-mo-4201 553.073384: congestion_wait: throttle_vm_writeout+0x70/0x7f shrink_mem_cgroup_zone+0x48f/0x4a1
>  gnome-system-mo-4201 553.073386: writeback_congestion_wait: usec_timeout=100000 usec_delayed=100000
>            gtali-4237 553.080377: congestion_wait: throttle_vm_writeout+0x70/0x7f shrink_mem_cgroup_zone+0x48f/0x4a1
>            gtali-4237 553.080378: writeback_congestion_wait: usec_timeout=100000 usec_delayed=100000
>             Xorg-3483 553.103375: congestion_wait: throttle_vm_writeout+0x70/0x7f shrink_mem_cgroup_zone+0x48f/0x4a1
>             Xorg-3483 553.103377: writeback_congestion_wait: usec_timeout=100000 usec_delayed=100000
> 
> The root cause is, the dirty threshold is knocked down a lot by the
> memory hog task. Fixed by using global_dirty_limit which decreases
> gradually on such events and can guarantee we stay above (the also
> decreasing) nr_dirty in the progress of following down to the new
> dirty threshold.
> 
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>

Acked-by: Johannes Weiner <hannes@cmpxchg.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: use global_dirty_limit in throttle_vm_writeout()
  2012-03-02  6:14 [PATCH] mm: use global_dirty_limit in throttle_vm_writeout() Fengguang Wu
  2012-03-05 20:06 ` Rik van Riel
  2012-03-19  7:37 ` Johannes Weiner
@ 2012-03-21  0:43 ` Minchan Kim
  2 siblings, 0 replies; 4+ messages in thread
From: Minchan Kim @ 2012-03-21  0:43 UTC (permalink / raw)
  To: Fengguang Wu
  Cc: Andrew Morton, Johannes Weiner, Jan Kara, Greg Thelen, Ying Han,
	KAMEZAWA Hiroyuki, Rik van Riel, Mel Gorman, Minchan Kim,
	Linux Memory Management List, LKML

Hi Wu,

Sorry for late response.
I have a question.

On Fri, Mar 02, 2012 at 02:14:51PM +0800, Fengguang Wu wrote:
> When starting a memory hog task, a desktop box w/o swap is found to go
> unresponsive for a long time. It's solely caused by lots of congestion
> waits in throttle_vm_writeout():
> 
>  gnome-system-mo-4201 553.073384: congestion_wait: throttle_vm_writeout+0x70/0x7f shrink_mem_cgroup_zone+0x48f/0x4a1
>  gnome-system-mo-4201 553.073386: writeback_congestion_wait: usec_timeout=100000 usec_delayed=100000
>            gtali-4237 553.080377: congestion_wait: throttle_vm_writeout+0x70/0x7f shrink_mem_cgroup_zone+0x48f/0x4a1
>            gtali-4237 553.080378: writeback_congestion_wait: usec_timeout=100000 usec_delayed=100000
>             Xorg-3483 553.103375: congestion_wait: throttle_vm_writeout+0x70/0x7f shrink_mem_cgroup_zone+0x48f/0x4a1
>             Xorg-3483 553.103377: writeback_congestion_wait: usec_timeout=100000 usec_delayed=100000
> 
> The root cause is, the dirty threshold is knocked down a lot by the
> memory hog task. Fixed by using global_dirty_limit which decreases

AFAIUC, memory hog task, you mean it consumes lots of anon pages, not file-backed pages.
So global_dirty_limits would get small available_memory by global_reclaimable_pages
so that it ends up dirty threshold is knocked down.

Could you confirm my understanding?

Thanks.

> gradually on such events and can guarantee we stay above (the also
> decreasing) nr_dirty in the progress of following down to the new
> dirty threshold.
> 
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
>  mm/page-writeback.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> --- linux.orig/mm/page-writeback.c	2012-03-02 14:05:01.633763187 +0800
> +++ linux/mm/page-writeback.c	2012-03-02 14:11:52.929772962 +0800
> @@ -1472,6 +1472,7 @@ void throttle_vm_writeout(gfp_t gfp_mask
>  
>          for ( ; ; ) {
>  		global_dirty_limits(&background_thresh, &dirty_thresh);
> +		dirty_thresh = hard_dirty_limit(dirty_thresh);
>  
>                  /*
>                   * Boost the allowable dirty threshold a bit for page

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-03-21  0:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-02  6:14 [PATCH] mm: use global_dirty_limit in throttle_vm_writeout() Fengguang Wu
2012-03-05 20:06 ` Rik van Riel
2012-03-19  7:37 ` Johannes Weiner
2012-03-21  0:43 ` Minchan Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).