]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - mm/compaction.c
Merge tag 'led-fixes-for-5.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / mm / compaction.c
index 6cc4bea33dcb55c266d6146f04c8ec7830b6dd60..9e1b9acb116b9b3efaabd8ee02538c20456b4714 100644 (file)
@@ -1230,7 +1230,7 @@ fast_isolate_around(struct compact_control *cc, unsigned long pfn, unsigned long
 
        /* Pageblock boundaries */
        start_pfn = pageblock_start_pfn(pfn);
-       end_pfn = min(start_pfn + pageblock_nr_pages, zone_end_pfn(cc->zone));
+       end_pfn = min(pageblock_end_pfn(pfn), zone_end_pfn(cc->zone)) - 1;
 
        /* Scan before */
        if (start_pfn != pfn) {
@@ -1241,7 +1241,7 @@ fast_isolate_around(struct compact_control *cc, unsigned long pfn, unsigned long
 
        /* Scan after */
        start_pfn = pfn + nr_isolated;
-       if (start_pfn != end_pfn)
+       if (start_pfn < end_pfn)
                isolate_freepages_block(cc, &start_pfn, end_pfn, &cc->freepages, 1, false);
 
        /* Skip this pageblock in the future as it's full or nearly full */
@@ -1399,7 +1399,7 @@ fast_isolate_freepages(struct compact_control *cc)
                                page = pfn_to_page(highest);
                                cc->free_pfn = highest;
                        } else {
-                               if (cc->direct_compaction) {
+                               if (cc->direct_compaction && pfn_valid(min_pfn)) {
                                        page = pfn_to_page(min_pfn);
                                        cc->free_pfn = min_pfn;
                                }
@@ -1888,13 +1888,13 @@ static enum compact_result __compact_finished(struct compact_control *cc)
                bool can_steal;
 
                /* Job done if page is free of the right migratetype */
-               if (!list_empty(&area->free_list[migratetype]))
+               if (!free_area_empty(area, migratetype))
                        return COMPACT_SUCCESS;
 
 #ifdef CONFIG_CMA
                /* MIGRATE_MOVABLE can fallback on MIGRATE_CMA */
                if (migratetype == MIGRATE_MOVABLE &&
-                       !list_empty(&area->free_list[MIGRATE_CMA]))
+                       !free_area_empty(area, MIGRATE_CMA))
                        return COMPACT_SUCCESS;
 #endif
                /*