summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mm/compaction.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/mm/compaction.c b/mm/compaction.c
index 7ca6842c665d..c4bc5acf865d 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -337,8 +337,17 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
continue;
nr_scanned++;
- /* Get the page and skip if free */
+ /*
+ * Get the page and ensure the page is within the same zone.
+ * See the comment in isolate_freepages about overlapping
+ * nodes. It is deliberate that the new zone lock is not taken
+ * as memory compaction should not move pages between nodes.
+ */
page = pfn_to_page(low_pfn);
+ if (page_zone(page) != zone)
+ continue;
+
+ /* Skip if free */
if (PageBuddy(page))
continue;