diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 37ce0c2f3bae87a61700df5b917ba7dda82f79e7..941a75b9fb5abe82506376c3eb8569e30058a1cb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8800,7 +8800,8 @@ static int __alloc_contig_migrate_range(struct compact_control *cc,
 
 	lru_cache_enable();
 	if (ret < 0) {
-		alloc_contig_dump_pages(&cc->migratepages);
+		if (ret == -EBUSY)
+			alloc_contig_dump_pages(&cc->migratepages);
 		putback_movable_pages(&cc->migratepages);
 		return ret;
 	}