migrate.h 2.3 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 16 17 18
enum migrate_reason {
	MR_COMPACTION,
	MR_MEMORY_FAILURE,
	MR_MEMORY_HOTPLUG,
	MR_SYSCALL,		/* also applies to cpusets */
	MR_MEMPOLICY_MBIND,
	MR_CMA
};

19
#ifdef CONFIG_MIGRATION
20

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

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

extern int migrate_prep(void);
35
extern int migrate_prep_local(void);
36 37 38
extern int migrate_vmas(struct mm_struct *mm,
		const nodemask_t *from, const nodemask_t *to,
		unsigned long flags);
N
Naoya Horiguchi 已提交
39 40 41
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 已提交
42
#else
43

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

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

55 56 57 58 59 60 61
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 已提交
62 63 64
static inline void migrate_page_copy(struct page *newpage,
				     struct page *page) {}

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

C
Christoph Lameter 已提交
71 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 */
#endif /* _LINUX_MIGRATE_H */