linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Mark the correct zone as full when scanning zonelists
@ 2008-09-11 21:25 Mel Gorman
  2008-09-11 21:41 ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Mel Gorman @ 2008-09-11 21:25 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, kamezawa.hiroyu, apw

The for_each_zone_zonelist() uses a struct zoneref *z cursor when scanning
zonelists to keep track of where in the zonelist it is. The zoneref that
is returned corresponds to the the next zone that is to be scanned, not
the current one as it originally thought of as an opaque list.

When the page allocator is scanning a zonelist, it marks zones that it
temporarily full zones to eliminate near-future scanning attempts. It uses
the zoneref for the marking and consequently the incorrect zone gets marked
full. This leads to a suitable zone being skipped in the mistaken belief
it is full. This patch corrects the problem by changing zoneref to be the
current zone being scanned instead of the next one.

Signed-off-by: Mel Gorman <mel@csn.ul.ie>
---
  include/linux/mmzone.h |   12 ++++++------
  mm/mmzone.c            |    2 +-
  2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 443bc7c..428328a 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -751,8 +751,9 @@ static inline int zonelist_node_idx(struct zoneref *zoneref)
  *
  * This function returns the next zone at or below a given zone index that is
  * within the allowed nodemask using a cursor as the starting point for the
- * search. The zoneref returned is a cursor that is used as the next starting
- * point for future calls to next_zones_zonelist().
+ * search. The zoneref returned is a cursor that represents the current zone
+ * being examined. It should be advanced by one before calling
+ * next_zones_zonelist again.
  */
 struct zoneref *next_zones_zonelist(struct zoneref *z,
 					enum zone_type highest_zoneidx,
@@ -768,9 +769,8 @@ struct zoneref *next_zones_zonelist(struct zoneref *z,
  *
  * This function returns the first zone at or below a given zone index that is
  * within the allowed nodemask. The zoneref returned is a cursor that can be
- * used to iterate the zonelist with next_zones_zonelist. The cursor should
- * not be used by the caller as it does not match the value of the zone
- * returned.
+ * used to iterate the zonelist with next_zones_zonelist by advancing it by
+ * one before calling.
  */
 static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
 					enum zone_type highest_zoneidx,
@@ -795,7 +795,7 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
 #define for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, nodemask) \
 	for (z = first_zones_zonelist(zlist, highidx, nodemask, &zone);	\
 		zone;							\
-		z = next_zones_zonelist(z, highidx, nodemask, &zone))	\
+		z = next_zones_zonelist(++z, highidx, nodemask, &zone))	\
 
 /**
  * for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a given zone index
diff --git a/mm/mmzone.c b/mm/mmzone.c
index 486ed59..16ce8b9 100644
--- a/mm/mmzone.c
+++ b/mm/mmzone.c
@@ -69,6 +69,6 @@ struct zoneref *next_zones_zonelist(struct zoneref *z,
 				(z->zone && !zref_in_nodemask(z, nodes)))
 			z++;
 
-	*zone = zonelist_zone(z++);
+	*zone = zonelist_zone(z);
 	return z;
 }

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2008-09-15 23:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-11 21:25 [PATCH] Mark the correct zone as full when scanning zonelists Mel Gorman
2008-09-11 21:41 ` Andrew Morton
2008-09-12  1:10   ` KAMEZAWA Hiroyuki
2008-09-12 20:37     ` Mel Gorman
2008-09-12 18:58   ` Mel Gorman
2008-09-15 23:20   ` Mel Gorman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox