blob: 3fff8e774067904bb73b5817ba471099a80555da [file] [log] [blame]
KAMEZAWA Hiroyukia5d76b52007-10-16 01:26:11 -07001#ifndef __LINUX_PAGEISOLATION_H
2#define __LINUX_PAGEISOLATION_H
3
Minchan Kim194159f2013-02-22 16:33:58 -08004#ifdef CONFIG_MEMORY_ISOLATION
5static inline bool is_migrate_isolate_page(struct page *page)
6{
7 return get_pageblock_migratetype(page) == MIGRATE_ISOLATE;
8}
9static inline bool is_migrate_isolate(int migratetype)
10{
11 return migratetype == MIGRATE_ISOLATE;
12}
13#else
14static inline bool is_migrate_isolate_page(struct page *page)
15{
16 return false;
17}
18static inline bool is_migrate_isolate(int migratetype)
19{
20 return false;
21}
22#endif
Minchan Kimee6f5092012-07-31 16:43:50 -070023
Wen Congyangb023f462012-12-11 16:00:45 -080024bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
25 bool skip_hwpoisoned_pages);
Minchan Kimee6f5092012-07-31 16:43:50 -070026void set_pageblock_migratetype(struct page *page, int migratetype);
27int move_freepages_block(struct zone *zone, struct page *page,
28 int migratetype);
Minchan Kim435b4052012-10-08 16:32:16 -070029int move_freepages(struct zone *zone,
30 struct page *start_page, struct page *end_page,
31 int migratetype);
32
KAMEZAWA Hiroyukia5d76b52007-10-16 01:26:11 -070033/*
34 * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE.
Michal Nazarewicz0815f3d2012-04-03 15:06:15 +020035 * If specified range includes migrate types other than MOVABLE or CMA,
KAMEZAWA Hiroyukia5d76b52007-10-16 01:26:11 -070036 * this will fail with -EBUSY.
37 *
38 * For isolating all pages in the range finally, the caller have to
39 * free all pages in the range. test_page_isolated() can be used for
40 * test it.
41 */
Minchan Kimee6f5092012-07-31 16:43:50 -070042int
Michal Nazarewicz0815f3d2012-04-03 15:06:15 +020043start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
Wen Congyangb023f462012-12-11 16:00:45 -080044 unsigned migratetype, bool skip_hwpoisoned_pages);
KAMEZAWA Hiroyukia5d76b52007-10-16 01:26:11 -070045
46/*
47 * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE.
48 * target range is [start_pfn, end_pfn)
49 */
Minchan Kimee6f5092012-07-31 16:43:50 -070050int
Michal Nazarewicz0815f3d2012-04-03 15:06:15 +020051undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
52 unsigned migratetype);
KAMEZAWA Hiroyukia5d76b52007-10-16 01:26:11 -070053
54/*
Michal Nazarewicz0815f3d2012-04-03 15:06:15 +020055 * Test all pages in [start_pfn, end_pfn) are isolated or not.
KAMEZAWA Hiroyukia5d76b52007-10-16 01:26:11 -070056 */
Wen Congyangb023f462012-12-11 16:00:45 -080057int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn,
58 bool skip_hwpoisoned_pages);
KAMEZAWA Hiroyukia5d76b52007-10-16 01:26:11 -070059
60/*
Michal Nazarewicz0815f3d2012-04-03 15:06:15 +020061 * Internal functions. Changes pageblock's migrate type.
KAMEZAWA Hiroyukia5d76b52007-10-16 01:26:11 -070062 */
Wen Congyangb023f462012-12-11 16:00:45 -080063int set_migratetype_isolate(struct page *page, bool skip_hwpoisoned_pages);
Minchan Kimee6f5092012-07-31 16:43:50 -070064void unset_migratetype_isolate(struct page *page, unsigned migratetype);
Minchan Kim723a0642012-10-08 16:32:52 -070065struct page *alloc_migrate_target(struct page *page, unsigned long private,
66 int **resultp);
KAMEZAWA Hiroyukia5d76b52007-10-16 01:26:11 -070067
68#endif