cc->nr_migratepages++;
                nr_isolated++;
 
+               /*
+                * Record where we could have freed pages by migration and not
+                * yet flushed them to buddy allocator.
+                * - this is the lowest page that was isolated and likely be
+                * then freed by migration.
+                */
+               if (!cc->last_migrated_pfn)
+                       cc->last_migrated_pfn = low_pfn;
+
                /* Avoid isolating too much */
                if (cc->nr_migratepages == COMPACT_CLUSTER_MAX) {
                        ++low_pfn;
        unsigned long block_start_pfn;
        unsigned long block_end_pfn;
        unsigned long low_pfn;
-       unsigned long isolate_start_pfn;
        struct page *page;
        const isolate_mode_t isolate_mode =
                (sysctl_compact_unevictable_allowed ? ISOLATE_UNEVICTABLE : 0) |
                        continue;
 
                /* Perform the isolation */
-               isolate_start_pfn = low_pfn;
                low_pfn = isolate_migratepages_block(cc, low_pfn,
                                                block_end_pfn, isolate_mode);
 
                        return ISOLATE_ABORT;
                }
 
-               /*
-                * Record where we could have freed pages by migration and not
-                * yet flushed them to buddy allocator.
-                * - this is the lowest page that could have been isolated and
-                * then freed by migration.
-                */
-               if (cc->nr_migratepages && !cc->last_migrated_pfn)
-                       cc->last_migrated_pfn = isolate_start_pfn;
-
                /*
                 * Either we isolated something and proceed with migration. Or
                 * we failed and compact_zone should decide if we should