aboutsummaryrefslogtreecommitdiffstats
path: root/mm/compaction.c
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2011-08-16 18:23:48 -0700
committerArve Hjønnevåg <arve@android.com>2011-11-17 17:54:33 -0800
commit377a311f93141e5b0784cc80ab469e1de493a5cf (patch)
tree074b20792f4de2418fda685b26f811277ef16457 /mm/compaction.c
parentb50a83d962dacab3c96bf697bd9b0699b6b4673c (diff)
downloadkernel_samsung_crespo-377a311f93141e5b0784cc80ab469e1de493a5cf.zip
kernel_samsung_crespo-377a311f93141e5b0784cc80ab469e1de493a5cf.tar.gz
kernel_samsung_crespo-377a311f93141e5b0784cc80ab469e1de493a5cf.tar.bz2
mm: compaction: Avoid memory holes when compacting memory
Call memmap_valid_within after converting a pfn to a page. Without this check, get_pageblock_migratetype would crash when it hit a memory hole. Change-Id: Ib2bb63731f1cde3d208829d5b2b62aaeaed95714 Signed-off-by: Arve Hjønnevåg <arve@android.com>
Diffstat (limited to 'mm/compaction.c')
-rw-r--r--mm/compaction.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/mm/compaction.c b/mm/compaction.c
index 6cc604b..642e456 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -85,6 +85,11 @@ static unsigned long isolate_freepages_block(struct zone *zone,
if (!pfn_valid_within(blockpfn))
continue;
+
+ /* Watch for unexpected holes punched in the memmap */
+ if (!memmap_valid_within(blockpfn, page, zone))
+ continue;
+
nr_scanned++;
if (!PageBuddy(page))
@@ -179,6 +184,11 @@ static void isolate_freepages(struct zone *zone,
* pages do not belong to a single zone.
*/
page = pfn_to_page(pfn);
+
+ /* Watch for unexpected holes punched in the memmap */
+ if (!memmap_valid_within(pfn, page, zone))
+ continue;
+
if (page_zone(page) != zone)
continue;
@@ -326,6 +336,11 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
/* Get the page and skip if free */
page = pfn_to_page(low_pfn);
+
+ /* Watch for unexpected holes punched in the memmap */
+ if (!memmap_valid_within(low_pfn, page, zone))
+ continue;
+
if (PageBuddy(page))
continue;