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>
This commit is contained in:

committed by
Marek Szyprowski

parent
47118af076
commit
0815f3d81d
@@ -5582,7 +5582,7 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void unset_migratetype_isolate(struct page *page)
|
||||
void unset_migratetype_isolate(struct page *page, unsigned migratetype)
|
||||
{
|
||||
struct zone *zone;
|
||||
unsigned long flags;
|
||||
@@ -5590,8 +5590,8 @@ void unset_migratetype_isolate(struct page *page)
|
||||
spin_lock_irqsave(&zone->lock, flags);
|
||||
if (get_pageblock_migratetype(page) != MIGRATE_ISOLATE)
|
||||
goto out;
|
||||
set_pageblock_migratetype(page, MIGRATE_MOVABLE);
|
||||
move_freepages_block(zone, page, MIGRATE_MOVABLE);
|
||||
set_pageblock_migratetype(page, migratetype);
|
||||
move_freepages_block(zone, page, migratetype);
|
||||
out:
|
||||
spin_unlock_irqrestore(&zone->lock, flags);
|
||||
}
|
||||
@@ -5669,6 +5669,10 @@ static int __alloc_contig_migrate_range(unsigned long start, unsigned long end)
|
||||
* alloc_contig_range() -- tries to allocate given range of pages
|
||||
* @start: start PFN to allocate
|
||||
* @end: one-past-the-last PFN to allocate
|
||||
* @migratetype: migratetype of the underlaying pageblocks (either
|
||||
* #MIGRATE_MOVABLE or #MIGRATE_CMA). All pageblocks
|
||||
* in range must have the same migratetype and it must
|
||||
* be either of the two.
|
||||
*
|
||||
* The PFN range does not have to be pageblock or MAX_ORDER_NR_PAGES
|
||||
* 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)
|
||||
* pages which PFN is in [start, end) are allocated for the caller and
|
||||
* need to be freed with free_contig_range().
|
||||
*/
|
||||
int alloc_contig_range(unsigned long start, unsigned long end)
|
||||
int alloc_contig_range(unsigned long start, unsigned long end,
|
||||
unsigned migratetype)
|
||||
{
|
||||
struct zone *zone = page_zone(pfn_to_page(start));
|
||||
unsigned long outer_start, outer_end;
|
||||
@@ -5712,7 +5717,7 @@ int alloc_contig_range(unsigned long start, unsigned long end)
|
||||
*/
|
||||
|
||||
ret = start_isolate_page_range(pfn_max_align_down(start),
|
||||
pfn_max_align_up(end));
|
||||
pfn_max_align_up(end), migratetype);
|
||||
if (ret)
|
||||
goto done;
|
||||
|
||||
@@ -5772,7 +5777,7 @@ int alloc_contig_range(unsigned long start, unsigned long end)
|
||||
|
||||
done:
|
||||
undo_isolate_page_range(pfn_max_align_down(start),
|
||||
pfn_max_align_up(end));
|
||||
pfn_max_align_up(end), migratetype);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user