[rh7,24/25] ms/mm/compaction: fix wrong order check in compact_finished()

Submitted by Andrey Ryabinin on Jan. 24, 2018, 12:15 p.m.


Message ID 20180124121503.26930-25-aryabinin@virtuozzo.com
State New
Series "compaction related stable backports."
Headers show

Commit Message

Andrey Ryabinin Jan. 24, 2018, 12:15 p.m.
From: Joonsoo Kim <iamjoonsoo.kim@lge.com>

What we want to check here is whether there is highorder freepage in buddy
list of other migratetype in order to steal it without fragmentation.
But, current code just checks cc->order which means allocation request
order.  So, this is wrong.

Without this fix, non-movable synchronous compaction below pageblock order
would not stopped until compaction is complete, because migratetype of
most pageblocks are movable and high order freepage made by compaction is
usually on movable type buddy list.

There is some report related to this bug. See below link.


Although the issued system still has load spike comes from compaction,
this makes that system completely stable and responsive according to his

stress-highalloc test in mmtests with non movable order 7 allocation
doesn't show any notable difference in allocation success rate, but, it
shows more compaction success rate.

Compaction success rate (Compaction success * 100 / Compaction stalls, %)
18.47 : 28.94

Fixes: 1fb3f8ca0e92 ("mm: compaction: capture a suitable high-order page immediately when it is made available")
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: David Rientjes <rientjes@google.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: <stable@vger.kernel.org>	[3.7+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 372549c2a3778fd3df445819811c944ad54609ca)
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
 mm/compaction.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/mm/compaction.c b/mm/compaction.c
index 4f6d23a87230..995097d8c50a 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -941,7 +941,7 @@  static int compact_finished(struct zone *zone,
 		/* Job done if allocation would set block type */
-		if (cc->order >= pageblock_order && area->nr_free)
+		if (order >= pageblock_order && area->nr_free)