migrate.h 2.5 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>
C
Christoph Lameter 已提交
6

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

9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * MIGRATE_ASYNC means never block
 * MIGRATE_SYNC_LIGHT in the current implementation means to allow blocking
 *	on most operations but not ->writepage as the potential stall time
 *	is too significant
 * MIGRATE_SYNC will block when migrating pages
 */
enum migrate_mode {
	MIGRATE_ASYNC,
	MIGRATE_SYNC_LIGHT,
	MIGRATE_SYNC,
};

22
#ifdef CONFIG_MIGRATION
23 24
#define PAGE_MIGRATION 1

25
extern void putback_lru_pages(struct list_head *l);
26
extern int migrate_page(struct address_space *,
27
			struct page *, struct page *, enum migrate_mode);
28
extern int migrate_pages(struct list_head *l, new_page_t x,
29
			unsigned long private, bool offlining,
30
			enum migrate_mode mode);
N
Naoya Horiguchi 已提交
31
extern int migrate_huge_pages(struct list_head *l, new_page_t x,
32
			unsigned long private, bool offlining,
33
			enum migrate_mode mode);
34

35 36
extern int fail_migrate_page(struct address_space *,
			struct page *, struct page *);
C
Christoph Lameter 已提交
37 38

extern int migrate_prep(void);
39
extern int migrate_prep_local(void);
40 41 42
extern int migrate_vmas(struct mm_struct *mm,
		const nodemask_t *from, const nodemask_t *to,
		unsigned long flags);
N
Naoya Horiguchi 已提交
43 44 45
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 已提交
46
#else
47 48
#define PAGE_MIGRATION 0

49
static inline void putback_lru_pages(struct list_head *l) {}
50
static 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; }
N
Naoya Horiguchi 已提交
53
static 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

C
Christoph Lameter 已提交
57
static inline int migrate_prep(void) { return -ENOSYS; }
58
static inline int migrate_prep_local(void) { return -ENOSYS; }
C
Christoph Lameter 已提交
59

60 61 62 63 64 65 66
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 已提交
67 68 69
static inline void migrate_page_copy(struct page *newpage,
				     struct page *page) {}

70
static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
N
Naoya Horiguchi 已提交
71 72 73 74 75
				  struct page *newpage, struct page *page)
{
	return -ENOSYS;
}

C
Christoph Lameter 已提交
76 77 78 79 80 81
/* 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 */