linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Shaohua Li <shaohua.li@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm <linux-mm@kvack.org>,
	mgorman@suse.de, Minchan Kim <minchan.kim@gmail.com>
Subject: [patch 1/3]vmscan: clear ZONE_CONGESTED for zone with good watermark
Date: Thu, 28 Jul 2011 16:13:01 +0800	[thread overview]
Message-ID: <1311840781.15392.407.camel@sli10-conroe> (raw)

correctly clear ZONE_CONGESTED. If a zone watermark is ok, we
should clear ZONE_CONGESTED regardless if this is a high order
allocation, because pages can be reclaimed in other tasks but
ZONE_CONGESTED is only cleared in kswapd.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
---
 mm/vmscan.c |   28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

Index: linux/mm/vmscan.c
===================================================================
--- linux.orig/mm/vmscan.c	2011-07-25 09:37:11.000000000 +0800
+++ linux/mm/vmscan.c	2011-07-28 15:17:56.000000000 +0800
@@ -2494,6 +2494,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)
@@ -2665,26 +2668,25 @@ out:
 	 * be cleared as kswapd is the only mechanism that clears the flag
 	 * and it is potentially going to sleep here.
 	 */
-	if (order) {
-		for (i = 0; i <= end_zone; i++) {
-			struct zone *zone = pgdat->node_zones + i;
+	for (i = 0; i <= end_zone; i++) {
+		struct zone *zone = pgdat->node_zones + i;
 
-			if (!populated_zone(zone))
-				continue;
+		if (!populated_zone(zone))
+			continue;
 
-			if (zone->all_unreclaimable && priority != DEF_PRIORITY)
-				continue;
+		if (zone->all_unreclaimable && priority != DEF_PRIORITY)
+			continue;
 
-			/* Confirm the zone is balanced for order-0 */
-			if (!zone_watermark_ok(zone, 0,
-					high_wmark_pages(zone), 0, 0)) {
+		/* Confirm the zone is balanced for order-0 */
+		if (!zone_watermark_ok(zone, 0, high_wmark_pages(zone), 0, 0)) {
+			if (order) {
 				order = sc.order = 0;
 				goto loop_again;
 			}
-
-			/* If balanced, clear the congested flag */
-			zone_clear_flag(zone, ZONE_CONGESTED);
 		}
+
+		/* If balanced, clear the congested flag */
+		zone_clear_flag(zone, ZONE_CONGESTED);
 	}
 
 	/*


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

             reply	other threads:[~2011-07-28  8:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-28  8:13 Shaohua Li [this message]
2011-07-28 10:56 ` Mel Gorman
2011-07-29  0:35   ` Shaohua Li
2011-07-29  8:50     ` Mel Gorman
2011-07-29 11:01       ` Shaohua Li
2011-07-29  9:13     ` Minchan Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311840781.15392.407.camel@sli10-conroe \
    --to=shaohua.li@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=minchan.kim@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox