migrate.h 2.6 KB
Newer Older
C
Christoph Lameter 已提交
1 2 3 4
#ifndef _LINUX_MIGRATE_H
#define _LINUX_MIGRATE_H

#include <linux/mm.h>
5
#include <linux/mempolicy.h>
6
#include <linux/migrate_mode.h>
C
Christoph Lameter 已提交
7

8
typedef struct page *new_page_t(struct page *, unsigned long private, int **);
9

10 11 12 13 14 15
enum migrate_reason {
	MR_COMPACTION,
	MR_MEMORY_FAILURE,
	MR_MEMORY_HOTPLUG,
	MR_SYSCALL,		/* also applies to cpusets */
	MR_MEMPOLICY_MBIND,
16
	MR_NUMA_MISPLACED,
17 18 19
	MR_CMA
};

20
#ifdef CONFIG_MIGRATION
21

22
extern void putback_lru_pages(struct list_head *l);
23
extern int migrate_page(struct address_space *,
24
			struct page *, struct page *, enum migrate_mode);
25
extern int migrate_pages(struct list_head *l, new_page_t x,
26
			unsigned long private, bool offlining,
27
			enum migrate_mode mode, int reason);
28
extern int migrate_huge_page(struct page *, new_page_t x,
29
			unsigned long private, bool offlining,
30
			enum migrate_mode mode);
31

32 33
extern int fail_migrate_page(struct address_space *,
			struct page *, struct page *);
C
Christoph Lameter 已提交
34 35

extern int migrate_prep(void);
36
extern int migrate_prep_local(void);
37 38 39
extern int migrate_vmas(struct mm_struct *mm,
		const nodemask_t *from, const nodemask_t *to,
		unsigned long flags);
N
Naoya Horiguchi 已提交
40 41 42
extern void migrate_page_copy(struct page *newpage, struct page *page);
extern int migrate_huge_page_move_mapping(struct address_space *mapping,
				  struct page *newpage, struct page *page);
C
Christoph Lameter 已提交
43
#else
44

45
static inline void putback_lru_pages(struct list_head *l) {}
46
static inline int migrate_pages(struct list_head *l, new_page_t x,
47
		unsigned long private, bool offlining,
48
		enum migrate_mode mode, int reason) { return -ENOSYS; }
49
static inline int migrate_huge_page(struct page *page, new_page_t x,
50
		unsigned long private, bool offlining,
51
		enum migrate_mode mode) { return -ENOSYS; }
52

C
Christoph Lameter 已提交
53
static inline int migrate_prep(void) { return -ENOSYS; }
54
static inline int migrate_prep_local(void) { return -ENOSYS; }
C
Christoph Lameter 已提交
55

56 57 58 59 60 61 62
static inline int migrate_vmas(struct mm_struct *mm,
		const nodemask_t *from, const nodemask_t *to,
		unsigned long flags)
{
	return -ENOSYS;
}

N
Naoya Horiguchi 已提交
63 64 65
static inline void migrate_page_copy(struct page *newpage,
				     struct page *page) {}

66
static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
N
Naoya Horiguchi 已提交
67 68 69 70 71
				  struct page *newpage, struct page *page)
{
	return -ENOSYS;
}

C
Christoph Lameter 已提交
72 73 74 75 76
/* Possible settings for the migrate_page() method in address_operations */
#define migrate_page NULL
#define fail_migrate_page NULL

#endif /* CONFIG_MIGRATION */
77 78 79 80 81 82 83 84 85 86

#ifdef CONFIG_NUMA_BALANCING
extern int migrate_misplaced_page(struct page *page, int node);
#else
static inline int migrate_misplaced_page(struct page *page, int node)
{
	return -EAGAIN; /* can't migrate now */
}
#endif /* CONFIG_NUMA_BALANCING */

C
Christoph Lameter 已提交
87
#endif /* _LINUX_MIGRATE_H */