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
@@ -24,6 +24,7 @@ __first_valid_page(unsigned long pfn, unsigned long nr_pages)
|
||||
* to be MIGRATE_ISOLATE.
|
||||
* @start_pfn: The lower PFN of the range to be isolated.
|
||||
* @end_pfn: The upper PFN of the range to be isolated.
|
||||
* @migratetype: migrate type to set in error recovery.
|
||||
*
|
||||
* Making page-allocation-type to be MIGRATE_ISOLATE means free pages in
|
||||
* the range will never be allocated. Any free pages and pages freed in the
|
||||
@@ -32,8 +33,8 @@ __first_valid_page(unsigned long pfn, unsigned long nr_pages)
|
||||
* start_pfn/end_pfn must be aligned to pageblock_order.
|
||||
* Returns 0 on success and -EBUSY if any part of range cannot be isolated.
|
||||
*/
|
||||
int
|
||||
start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn)
|
||||
int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
|
||||
unsigned migratetype)
|
||||
{
|
||||
unsigned long pfn;
|
||||
unsigned long undo_pfn;
|
||||
@@ -56,7 +57,7 @@ undo:
|
||||
for (pfn = start_pfn;
|
||||
pfn < undo_pfn;
|
||||
pfn += pageblock_nr_pages)
|
||||
unset_migratetype_isolate(pfn_to_page(pfn));
|
||||
unset_migratetype_isolate(pfn_to_page(pfn), migratetype);
|
||||
|
||||
return -EBUSY;
|
||||
}
|
||||
@@ -64,8 +65,8 @@ undo:
|
||||
/*
|
||||
* Make isolated pages available again.
|
||||
*/
|
||||
int
|
||||
undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn)
|
||||
int undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
|
||||
unsigned migratetype)
|
||||
{
|
||||
unsigned long pfn;
|
||||
struct page *page;
|
||||
@@ -77,7 +78,7 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn)
|
||||
page = __first_valid_page(pfn, pageblock_nr_pages);
|
||||
if (!page || get_pageblock_migratetype(page) != MIGRATE_ISOLATE)
|
||||
continue;
|
||||
unset_migratetype_isolate(page);
|
||||
unset_migratetype_isolate(page, migratetype);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -86,7 +87,7 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn)
|
||||
* all pages in [start_pfn...end_pfn) must be in the same zone.
|
||||
* zone->lock must be held before call this.
|
||||
*
|
||||
* Returns 1 if all pages in the range is isolated.
|
||||
* Returns 1 if all pages in the range are isolated.
|
||||
*/
|
||||
static int
|
||||
__test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn)
|
||||
|
Reference in New Issue
Block a user