diff options
author | Andy Green <andy.green@linaro.org> | 2011-12-20 08:58:23 +0800 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2011-12-26 15:09:53 +0800 |
commit | 5ada9db852cd35378b4bf5dd6ffca2b0887bdebd (patch) | |
tree | d87906bc40e96c9112e5abc9b0982045a61139a3 /mm | |
parent | d79d4bfd8750381758b0c38daa96cc2421da5866 (diff) |
This is a quick and dirty patch and hack to solve some memory allocation
issues that appeared at CMA v17 after switching migration code from
hotplug to memory compaction. Especially the issue with watermark
adjustment need a real fix instead of disabling the code.
Signed-off-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/compaction.c | 5 | ||||
-rw-r--r-- | mm/page_alloc.c | 12 |
2 files changed, 13 insertions, 4 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index 3e073412e0f..41976f819c4 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -79,8 +79,9 @@ isolate_freepages_range(struct zone *zone, skip: if (freelist) goto next; +failed: for (; start < pfn; ++start) - __free_page(pfn_to_page(pfn)); + __free_page(pfn_to_page(start)); return 0; } @@ -91,6 +92,8 @@ skip: struct page *p = page; for (i = isolated; i; --i, ++p) list_add(&p->lru, freelist); + } else if (!isolated) { + goto failed; } next: diff --git a/mm/page_alloc.c b/mm/page_alloc.c index aba6c9fe143..0726cc30417 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1303,12 +1303,12 @@ int split_free_page(struct page *page) zone = page_zone(page); order = page_order(page); - +#if 0 /* Obey watermarks as if the page was being allocated */ watermark = low_wmark_pages(zone) + (1 << order); if (!zone_watermark_ok(zone, 0, watermark, 0, 0)) return 0; - +#endif /* Remove page from free list */ list_del(&page->lru); zone->free_area[order].nr_free--; @@ -5740,6 +5740,12 @@ static unsigned long pfn_align_to_maxpage_up(unsigned long pfn) return ALIGN(pfn, MAX_ORDER_NR_PAGES); } +static struct page * +cma_migrate_alloc(struct page *page, unsigned long private, int **x) +{ + return alloc_page(GFP_HIGHUSER_MOVABLE); +} + static int __alloc_contig_migrate_range(unsigned long start, unsigned long end) { /* This function is based on compact_zone() from compaction.c. */ @@ -5807,7 +5813,7 @@ static int __alloc_contig_migrate_range(unsigned long start, unsigned long end) } /* Try to migrate. */ - ret = migrate_pages(&cc.migratepages, compaction_alloc, + ret = migrate_pages(&cc.migratepages, cma_migrate_alloc, (unsigned long)&cc, false, cc.sync); /* Migrated all of them? Great! */ |