linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [patch]vmscan: clear ZONE_CONGESTED for zone with good watermark -resend
@ 2011-08-22  1:07 Shaohua Li
  0 siblings, 0 replies; only message in thread
From: Shaohua Li @ 2011-08-22  1:07 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, mel, Minchan Kim

ZONE_CONGESTED is only cleared in kswapd, but pages can be freed in any task.
It's possible ZONE_CONGESTED isn't cleared in some cases:
1. the zone is already balanced just entering balance_pgdat() for order-0 because
concurrent tasks free memory. In this case, later check will skip the zone as
it's balanced so the flag isn't cleared.
2. high order balance fallbacks to order-0. quote from Mel:
At the end of balance_pgdat(), kswapd uses the following logic;

 If reclaiming at high order {
     for each zone {
             if all_unreclaimable
                     skip
             if watermark is not met
                     order = 0
                     loop again

             /* watermark is met */
             clear congested
     }
 }

i.e. it clears ZONE_CONGESTED if it the zone is balanced. if not,
it restarts balancing at order-0. However, if the higher zones are
balanced for order-0, kswapd will miss clearing ZONE_CONGESTED
as that only happens after a zone is shrunk.
This can mean that wait_iff_congested() stalls unnecessarily. This patch
makes kswapd clear ZONE_CONGESTED during its initial highmem->dma scan
for zones that are already balanced.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
---
 mm/vmscan.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux/mm/vmscan.c
===================================================================
--- linux.orig/mm/vmscan.c	2011-08-11 09:26:37.000000000 +0800
+++ linux/mm/vmscan.c	2011-08-22 09:01:19.000000000 +0800
@@ -2529,6 +2529,9 @@ loop_again:
 					high_wmark_pages(zone), 0, 0)) {
 				end_zone = i;
 				break;
+			} else {
+				/* If balanced, clear the congested flag */
+				zone_clear_flag(zone, ZONE_CONGESTED);
 			}
 		}
 		if (i < 0)


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-22  1:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-22  1:07 [patch]vmscan: clear ZONE_CONGESTED for zone with good watermark -resend Shaohua Li

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).