aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2012-04-03 09:06:15 -0400
committerMarek Szyprowski <m.szyprowski@samsung.com>2012-05-21 09:09:33 -0400
commit0815f3d81d76dfbf2abcfd93a85ff0a6008fe4c0 (patch)
tree750e239c7c522a206bb04bd8bfcd89c3bf3be30d /mm/page_alloc.c
parent47118af076f64844b4f423bc2f545b2da9dab50d (diff)
mm: page_isolation: MIGRATE_CMA isolation functions added
This commit changes various functions that change pages and pageblocks migrate type between MIGRATE_ISOLATE and MIGRATE_MOVABLE in such a way as to allow to work with MIGRATE_CMA migrate type. Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Tested-by: Rob Clark <rob.clark@linaro.org> Tested-by: Ohad Ben-Cohen <ohad@wizery.com> Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Tested-by: Robert Nelson <robertcnelson@gmail.com> Tested-by: Barry Song <Baohua.Song@csr.com>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0869eb1e9461..116c087f76bb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5582,7 +5582,7 @@ out:
5582 return ret; 5582 return ret;
5583} 5583}
5584 5584
5585void unset_migratetype_isolate(struct page *page) 5585void unset_migratetype_isolate(struct page *page, unsigned migratetype)
5586{ 5586{
5587 struct zone *zone; 5587 struct zone *zone;
5588 unsigned long flags; 5588 unsigned long flags;
@@ -5590,8 +5590,8 @@ void unset_migratetype_isolate(struct page *page)
5590 spin_lock_irqsave(&zone->lock, flags); 5590 spin_lock_irqsave(&zone->lock, flags);
5591 if (get_pageblock_migratetype(page) != MIGRATE_ISOLATE) 5591 if (get_pageblock_migratetype(page) != MIGRATE_ISOLATE)
5592 goto out; 5592 goto out;
5593 set_pageblock_migratetype(page, MIGRATE_MOVABLE); 5593 set_pageblock_migratetype(page, migratetype);
5594 move_freepages_block(zone, page, MIGRATE_MOVABLE); 5594 move_freepages_block(zone, page, migratetype);
5595out: 5595out:
5596 spin_unlock_irqrestore(&zone->lock, flags); 5596 spin_unlock_irqrestore(&zone->lock, flags);
5597} 5597}
@@ -5669,6 +5669,10 @@ static int __alloc_contig_migrate_range(unsigned long start, unsigned long end)
5669 * alloc_contig_range() -- tries to allocate given range of pages 5669 * alloc_contig_range() -- tries to allocate given range of pages
5670 * @start: start PFN to allocate 5670 * @start: start PFN to allocate
5671 * @end: one-past-the-last PFN to allocate 5671 * @end: one-past-the-last PFN to allocate
5672 * @migratetype: migratetype of the underlaying pageblocks (either
5673 * #MIGRATE_MOVABLE or #MIGRATE_CMA). All pageblocks
5674 * in range must have the same migratetype and it must
5675 * be either of the two.
5672 * 5676 *
5673 * The PFN range does not have to be pageblock or MAX_ORDER_NR_PAGES 5677 * The PFN range does not have to be pageblock or MAX_ORDER_NR_PAGES
5674 * aligned, however it's the caller's responsibility to guarantee that 5678 * aligned, however it's the caller's responsibility to guarantee that
@@ -5681,7 +5685,8 @@ static int __alloc_contig_migrate_range(unsigned long start, unsigned long end)
5681 * pages which PFN is in [start, end) are allocated for the caller and 5685 * pages which PFN is in [start, end) are allocated for the caller and
5682 * need to be freed with free_contig_range(). 5686 * need to be freed with free_contig_range().
5683 */ 5687 */
5684int alloc_contig_range(unsigned long start, unsigned long end) 5688int alloc_contig_range(unsigned long start, unsigned long end,
5689 unsigned migratetype)
5685{ 5690{
5686 struct zone *zone = page_zone(pfn_to_page(start)); 5691 struct zone *zone = page_zone(pfn_to_page(start));
5687 unsigned long outer_start, outer_end; 5692 unsigned long outer_start, outer_end;
@@ -5712,7 +5717,7 @@ int alloc_contig_range(unsigned long start, unsigned long end)
5712 */ 5717 */
5713 5718
5714 ret = start_isolate_page_range(pfn_max_align_down(start), 5719 ret = start_isolate_page_range(pfn_max_align_down(start),
5715 pfn_max_align_up(end)); 5720 pfn_max_align_up(end), migratetype);
5716 if (ret) 5721 if (ret)
5717 goto done; 5722 goto done;
5718 5723
@@ -5772,7 +5777,7 @@ int alloc_contig_range(unsigned long start, unsigned long end)
5772 5777
5773done: 5778done:
5774 undo_isolate_page_range(pfn_max_align_down(start), 5779 undo_isolate_page_range(pfn_max_align_down(start),
5775 pfn_max_align_up(end)); 5780 pfn_max_align_up(end), migratetype);
5776 return ret; 5781 return ret;
5777} 5782}
5778 5783