Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1#ifndef _LINUX_MIGRATE_H
2#define _LINUX_MIGRATE_H
3
4#include <linux/mm.h>
5#include <linux/mempolicy.h>
6
7typedef struct page *new_page_t(struct page *, unsigned long private, int **);
8
9/*
10 * MIGRATE_ASYNC means never block
11 * MIGRATE_SYNC_LIGHT in the current implementation means to allow blocking
12 * on most operations but not ->writepage as the potential stall time
13 * is too significant
14 * MIGRATE_SYNC will block when migrating pages
15 */
16enum migrate_mode {
17 MIGRATE_ASYNC,
18 MIGRATE_SYNC_LIGHT,
19 MIGRATE_SYNC,
20};
21
22#ifdef CONFIG_MIGRATION
23#define PAGE_MIGRATION 1
24
25extern void putback_lru_pages(struct list_head *l);
26extern int migrate_page(struct address_space *,
27 struct page *, struct page *, enum migrate_mode);
28extern int migrate_pages(struct list_head *l, new_page_t x,
29 unsigned long private, bool offlining,
30 enum migrate_mode mode);
31extern int migrate_huge_pages(struct list_head *l, new_page_t x,
32 unsigned long private, bool offlining,
33 enum migrate_mode mode);
34
35extern int fail_migrate_page(struct address_space *,
36 struct page *, struct page *);
37
38extern int migrate_prep(void);
39extern int migrate_prep_local(void);
40extern int migrate_vmas(struct mm_struct *mm,
41 const nodemask_t *from, const nodemask_t *to,
42 unsigned long flags);
43extern void migrate_page_copy(struct page *newpage, struct page *page);
44extern int migrate_huge_page_move_mapping(struct address_space *mapping,
45 struct page *newpage, struct page *page);
46#else
47#define PAGE_MIGRATION 0
48
49static inline void putback_lru_pages(struct list_head *l) {}
50static inline int migrate_pages(struct list_head *l, new_page_t x,
51 unsigned long private, bool offlining,
52 enum migrate_mode mode) { return -ENOSYS; }
53static inline int migrate_huge_pages(struct list_head *l, new_page_t x,
54 unsigned long private, bool offlining,
55 enum migrate_mode mode) { return -ENOSYS; }
56
57static inline int migrate_prep(void) { return -ENOSYS; }
58static inline int migrate_prep_local(void) { return -ENOSYS; }
59
60static inline int migrate_vmas(struct mm_struct *mm,
61 const nodemask_t *from, const nodemask_t *to,
62 unsigned long flags)
63{
64 return -ENOSYS;
65}
66
67static inline void migrate_page_copy(struct page *newpage,
68 struct page *page) {}
69
70static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
71 struct page *newpage, struct page *page)
72{
73 return -ENOSYS;
74}
75
76/* Possible settings for the migrate_page() method in address_operations */
77#define migrate_page NULL
78#define fail_migrate_page NULL
79
80#endif /* CONFIG_MIGRATION */
81#endif /* _LINUX_MIGRATE_H */