Skip to contentSkip to conversation

mm/vmscan: not check compaction_ready on promoted zones

PATCH In review Weijie Yang 2 participants 2 messages Feb 14, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 2/2 mm/vmscan: not check compaction_ready on promoted zones

We abort direct reclaim if find the zone is ready for compaction. Sometimes the zone is just a promoted highmem zone to force scan pinning highmem, which is not the intended zone the caller want to alloc page from. In this situation, setting aborted_reclaim to indicate the caller turn back to retry allocation is waste of time and could cause a loop in __alloc_pages_slowpath().

This patch do not check compaction_ready() on promoted zones to avoid the above situation, only set aborted_reclaim if the caller intended zone is ready to compaction.

---
 mm/vmscan.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
mm/vmscan.c +3 -1
index da0a87c..9ec6519 100644
@@ -2299,6 +2299,7 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
 	unsigned long nr_soft_scanned;
 	bool aborted_reclaim = false;
 	gfp_t orig_mask = sc->gfp_mask;
+	enum zone_type requested_highidx = gfp_zone(sc->gfp_mask);
 
 	/*
 	 * If the number of buffer_heads in the machine exceeds the maximum
@@ -2332,7 +2333,8 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
 				 * noticeable problem, like transparent huge
 				 * page allocations.
 				 */
-				if (compaction_ready(zone, sc)) {
+				if ((zonelist_zone_idx(z) <= requested_highidx)
+				    && compaction_ready(zone, sc)) {
 					aborted_reclaim = true;
 					continue;
 				}
Signature · 1 line
1.7.10.4
Acked-by on v2 2/2
#1 lore raw
Quoted 7 lines · Weijie Yang

We abort direct reclaim if find the zone is ready for compaction. Sometimes the zone is just a promoted highmem zone to force scan pinning highmem, which is not the intended zone the caller want to alloc page from. In this situation, setting aborted_reclaim to indicate the caller turn back to retry allocation is waste of time and could cause a loop in __alloc_pages_slowpath().

Quoted 6 lines

This patch do not check compaction_ready() on promoted zones to avoid the above situation, only set aborted_reclaim if the caller intended zone is ready to compaction.

Signature · 8 lines
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>