2014-02-13 02:42:07

by Weijie Yang

[permalink] [raw]
Subject: [PATCH 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.

Signed-off-by: Weijie Yang <[email protected]>
---
mm/vmscan.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 35879f0..73e2577 100755
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2299,6 +2299,7 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
unsigned long nr_soft_scanned;
bool aborted_reclaim = false;
bool promoted_mask = false;
+ enum zone_type requested_highidx = gfp_zone(sc->gfp_mask);

/*
* If the number of buffer_heads in the machine exceeds the maximum
@@ -2334,7 +2335,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;
}
--
1.7.10.4


2014-02-13 16:11:25

by Rik van Riel

[permalink] [raw]
Subject: Re: [PATCH 2/2] mm/vmscan: not check compaction_ready on promoted zones

On 02/12/2014 09:41 PM, Weijie Yang wrote:
> 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.
>
> Signed-off-by: Weijie Yang <[email protected]>

Acked-by: Rik van Riel <[email protected]>


--
All rights reversed