]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - mm/compaction.c
drm/radeon: forever loop on error in radeon_do_test_moves()
[karo-tx-linux.git] / mm / compaction.c
index 05ccb4cc0bdb984dc2613461703587ec199804cd..b5326b141a251905a96cd5cd995063a29ca20f91 100644 (file)
@@ -677,6 +677,13 @@ static void isolate_freepages(struct zone *zone,
                                        pfn -= pageblock_nr_pages) {
                unsigned long isolated;
 
+               /*
+                * This can iterate a massively long zone without finding any
+                * suitable migration targets, so periodically check if we need
+                * to schedule.
+                */
+               cond_resched();
+
                if (!pfn_valid(pfn))
                        continue;
 
@@ -1131,6 +1138,9 @@ void compact_pgdat(pg_data_t *pgdat, int order)
                .sync = false,
        };
 
+       if (!order)
+               return;
+
        __compact_pgdat(pgdat, &cc);
 }