提交 9bbc04ee 编写于 作者: W Weijie Yang 提交者: Linus Torvalds

mm/vmscan: do not check compaction_ready on promoted zones

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

This patch does not check compaction_ready() on promoted zones to avoid
the above situation.  Only set aborted_reclaim if the caller intended
zone is ready for compaction.
Signed-off-by: NWeijie Yang <weijie.yang@samsung.com>
Acked-by: NRik van Riel <riel@redhat.com>
Acked-by: NMel Gorman <mgorman@suse.de>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 619d0d76
...@@ -2318,6 +2318,7 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc) ...@@ -2318,6 +2318,7 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
struct shrink_control shrink = { struct shrink_control shrink = {
.gfp_mask = sc->gfp_mask, .gfp_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 * If the number of buffer_heads in the machine exceeds the maximum
...@@ -2358,7 +2359,8 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc) ...@@ -2358,7 +2359,8 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
* noticeable problem, like transparent huge * noticeable problem, like transparent huge
* page allocations. * page allocations.
*/ */
if (compaction_ready(zone, sc)) { if ((zonelist_zone_idx(z) <= requested_highidx)
&& compaction_ready(zone, sc)) {
aborted_reclaim = true; aborted_reclaim = true;
continue; continue;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册