1 #ifndef _LINUX_MIGRATE_H
2 #define _LINUX_MIGRATE_H
3 
4 #include <linux/mm.h>
5 #include <linux/mempolicy.h>
6 #include <linux/migrate_mode.h>
7 
8 typedef struct page *new_page_t(struct page *, unsigned long private, int **);
9 
10 #ifdef CONFIG_MIGRATION
11 #define PAGE_MIGRATION 1
12 
13 extern void putback_lru_pages(struct list_head *l);
14 extern int migrate_page(struct address_space *,
15 			struct page *, struct page *, enum migrate_mode);
16 extern int migrate_pages(struct list_head *l, new_page_t x,
17 			unsigned long private, bool offlining,
18 			enum migrate_mode mode);
19 extern int migrate_huge_pages(struct list_head *l, new_page_t x,
20 			unsigned long private, bool offlining,
21 			enum migrate_mode mode);
22 
23 extern int fail_migrate_page(struct address_space *,
24 			struct page *, struct page *);
25 
26 extern int migrate_prep(void);
27 extern int migrate_prep_local(void);
28 extern int migrate_vmas(struct mm_struct *mm,
29 		const nodemask_t *from, const nodemask_t *to,
30 		unsigned long flags);
31 extern void migrate_page_copy(struct page *newpage, struct page *page);
32 extern int migrate_huge_page_move_mapping(struct address_space *mapping,
33 				  struct page *newpage, struct page *page);
34 #else
35 #define PAGE_MIGRATION 0
36 
putback_lru_pages(struct list_head * l)37 static inline void putback_lru_pages(struct list_head *l) {}
migrate_pages(struct list_head * l,new_page_t x,unsigned long private,bool offlining,enum migrate_mode mode)38 static inline int migrate_pages(struct list_head *l, new_page_t x,
39 		unsigned long private, bool offlining,
40 		enum migrate_mode mode) { return -ENOSYS; }
migrate_huge_pages(struct list_head * l,new_page_t x,unsigned long private,bool offlining,enum migrate_mode mode)41 static inline int migrate_huge_pages(struct list_head *l, new_page_t x,
42 		unsigned long private, bool offlining,
43 		enum migrate_mode mode) { return -ENOSYS; }
44 
migrate_prep(void)45 static inline int migrate_prep(void) { return -ENOSYS; }
migrate_prep_local(void)46 static inline int migrate_prep_local(void) { return -ENOSYS; }
47 
migrate_vmas(struct mm_struct * mm,const nodemask_t * from,const nodemask_t * to,unsigned long flags)48 static inline int migrate_vmas(struct mm_struct *mm,
49 		const nodemask_t *from, const nodemask_t *to,
50 		unsigned long flags)
51 {
52 	return -ENOSYS;
53 }
54 
migrate_page_copy(struct page * newpage,struct page * page)55 static inline void migrate_page_copy(struct page *newpage,
56 				     struct page *page) {}
57 
migrate_huge_page_move_mapping(struct address_space * mapping,struct page * newpage,struct page * page)58 static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
59 				  struct page *newpage, struct page *page)
60 {
61 	return -ENOSYS;
62 }
63 
64 /* Possible settings for the migrate_page() method in address_operations */
65 #define migrate_page NULL
66 #define fail_migrate_page NULL
67 
68 #endif /* CONFIG_MIGRATION */
69 #endif /* _LINUX_MIGRATE_H */
70