diff options
author | Vlastimil Babka <vbabka@suse.cz> | 2014-12-10 18:43:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 20:41:06 -0500 |
commit | 97d47a65be1e513edd02325ae828c9997878b578 (patch) | |
tree | 448af70cf65656d52889586d9022cb47996f1a4b /mm/page_alloc.c | |
parent | ebff398017c69a3810bcbc5200ba224d5ccaa207 (diff) |
mm, compaction: simplify deferred compaction
Since commit 53853e2d2bfb ("mm, compaction: defer each zone individually
instead of preferred zone"), compaction is deferred for each zone where
sync direct compaction fails, and reset where it succeeds. However, it
was observed that for DMA zone compaction often appeared to succeed
while subsequent allocation attempt would not, due to different outcome
of watermark check.
In order to properly defer compaction in this zone, the candidate zone
has to be passed back to __alloc_pages_direct_compact() and compaction
deferred in the zone after the allocation attempt fails.
The large source of mismatch between watermark check in compaction and
allocation was the lack of alloc_flags and classzone_idx values in
compaction, which has been fixed in the previous patch. So with this
problem fixed, we can simplify the code by removing the candidate_zone
parameter and deferring in __alloc_pages_direct_compact().
After this patch, the compaction activity during stress-highalloc
benchmark is still somewhat increased, but it's negligible compared to the
increase that occurred without the better watermark checking. This
suggests that it is still possible to apparently succeed in compaction but
fail to allocate, possibly due to parallel allocation activity.
[akpm@linux-foundation.org: fix build]
Suggested-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e32121fa2ba9..edb0ce1e7cf3 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2330,7 +2330,6 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, | |||
2330 | int classzone_idx, int migratetype, enum migrate_mode mode, | 2330 | int classzone_idx, int migratetype, enum migrate_mode mode, |
2331 | int *contended_compaction, bool *deferred_compaction) | 2331 | int *contended_compaction, bool *deferred_compaction) |
2332 | { | 2332 | { |
2333 | struct zone *last_compact_zone = NULL; | ||
2334 | unsigned long compact_result; | 2333 | unsigned long compact_result; |
2335 | struct page *page; | 2334 | struct page *page; |
2336 | 2335 | ||
@@ -2341,8 +2340,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, | |||
2341 | compact_result = try_to_compact_pages(zonelist, order, gfp_mask, | 2340 | compact_result = try_to_compact_pages(zonelist, order, gfp_mask, |
2342 | nodemask, mode, | 2341 | nodemask, mode, |
2343 | contended_compaction, | 2342 | contended_compaction, |
2344 | alloc_flags, classzone_idx, | 2343 | alloc_flags, classzone_idx); |
2345 | &last_compact_zone); | ||
2346 | current->flags &= ~PF_MEMALLOC; | 2344 | current->flags &= ~PF_MEMALLOC; |
2347 | 2345 | ||
2348 | switch (compact_result) { | 2346 | switch (compact_result) { |
@@ -2380,14 +2378,6 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, | |||
2380 | } | 2378 | } |
2381 | 2379 | ||
2382 | /* | 2380 | /* |
2383 | * last_compact_zone is where try_to_compact_pages thought allocation | ||
2384 | * should succeed, so it did not defer compaction. But here we know | ||
2385 | * that it didn't succeed, so we do the defer. | ||
2386 | */ | ||
2387 | if (last_compact_zone && mode != MIGRATE_ASYNC) | ||
2388 | defer_compaction(last_compact_zone, order); | ||
2389 | |||
2390 | /* | ||
2391 | * It's bad if compaction run occurs and fails. The most likely reason | 2381 | * It's bad if compaction run occurs and fails. The most likely reason |
2392 | * is that pages exist, but not enough to satisfy watermarks. | 2382 | * is that pages exist, but not enough to satisfy watermarks. |
2393 | */ | 2383 | */ |