vmscan: only defer compaction for failed order and higher
Currently a failed order-9 (transparent hugepage) compaction can lead to memory compaction being temporarily disabled for a memory zone. Even if we only need compaction for an order 2 allocation, eg. for jumbo frames networking. The fix is relatively straightforward: keep track of the highest order at which compaction is succeeding, and only defer compaction for orders at which compaction is failing. Signed-off-by: Rik van Riel <riel@redhat.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Acked-by: Mel Gorman <mel@csn.ul.ie> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Minchan Kim <minchan.kim@gmail.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Hillf Danton <dhillf@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
7be62de99a
commit
aff622495c
@@ -1990,7 +1990,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
|
||||
if (!order)
|
||||
return NULL;
|
||||
|
||||
if (compaction_deferred(preferred_zone)) {
|
||||
if (compaction_deferred(preferred_zone, order)) {
|
||||
*deferred_compaction = true;
|
||||
return NULL;
|
||||
}
|
||||
@@ -2012,6 +2012,8 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
|
||||
if (page) {
|
||||
preferred_zone->compact_considered = 0;
|
||||
preferred_zone->compact_defer_shift = 0;
|
||||
if (order >= preferred_zone->compact_order_failed)
|
||||
preferred_zone->compact_order_failed = order + 1;
|
||||
count_vm_event(COMPACTSUCCESS);
|
||||
return page;
|
||||
}
|
||||
@@ -2028,7 +2030,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
|
||||
* defer if the failure was a sync compaction failure.
|
||||
*/
|
||||
if (sync_migration)
|
||||
defer_compaction(preferred_zone);
|
||||
defer_compaction(preferred_zone, order);
|
||||
|
||||
cond_resched();
|
||||
}
|
||||
|
Reference in New Issue
Block a user