mm: numa: Rate limit setting of pte_numa if node is saturated
[linux-block.git] / include / linux / migrate.h
CommitLineData
b20a3503
CL
1#ifndef _LINUX_MIGRATE_H
2#define _LINUX_MIGRATE_H
3
b20a3503 4#include <linux/mm.h>
906e0be1 5#include <linux/mempolicy.h>
6536e312 6#include <linux/migrate_mode.h>
b20a3503 7
742755a1 8typedef struct page *new_page_t(struct page *, unsigned long private, int **);
95a402c3 9
7b2a2d4a
MG
10enum migrate_reason {
11 MR_COMPACTION,
12 MR_MEMORY_FAILURE,
13 MR_MEMORY_HOTPLUG,
14 MR_SYSCALL, /* also applies to cpusets */
15 MR_MEMPOLICY_MBIND,
7039e1db 16 MR_NUMA_MISPLACED,
7b2a2d4a
MG
17 MR_CMA
18};
19
906e0be1 20#ifdef CONFIG_MIGRATION
64cdd548 21
e13861d8 22extern void putback_lru_pages(struct list_head *l);
2d1db3b1 23extern int migrate_page(struct address_space *,
a6bc32b8 24 struct page *, struct page *, enum migrate_mode);
62b61f61 25extern int migrate_pages(struct list_head *l, new_page_t x,
7f0f2496 26 unsigned long private, bool offlining,
7b2a2d4a 27 enum migrate_mode mode, int reason);
189ebff2 28extern int migrate_huge_page(struct page *, new_page_t x,
7f0f2496 29 unsigned long private, bool offlining,
a6bc32b8 30 enum migrate_mode mode);
95a402c3 31
2d1db3b1
CL
32extern int fail_migrate_page(struct address_space *,
33 struct page *, struct page *);
b20a3503
CL
34
35extern int migrate_prep(void);
748446bb 36extern int migrate_prep_local(void);
7b2259b3
CL
37extern int migrate_vmas(struct mm_struct *mm,
38 const nodemask_t *from, const nodemask_t *to,
39 unsigned long flags);
290408d4
NH
40extern void migrate_page_copy(struct page *newpage, struct page *page);
41extern int migrate_huge_page_move_mapping(struct address_space *mapping,
42 struct page *newpage, struct page *page);
b20a3503 43#else
64cdd548 44
e13861d8 45static inline void putback_lru_pages(struct list_head *l) {}
95a402c3 46static inline int migrate_pages(struct list_head *l, new_page_t x,
7f0f2496 47 unsigned long private, bool offlining,
7b2a2d4a 48 enum migrate_mode mode, int reason) { return -ENOSYS; }
189ebff2 49static inline int migrate_huge_page(struct page *page, new_page_t x,
7f0f2496 50 unsigned long private, bool offlining,
a6bc32b8 51 enum migrate_mode mode) { return -ENOSYS; }
9bf9e89c 52
b20a3503 53static inline int migrate_prep(void) { return -ENOSYS; }
748446bb 54static inline int migrate_prep_local(void) { return -ENOSYS; }
b20a3503 55
7b2259b3
CL
56static inline int migrate_vmas(struct mm_struct *mm,
57 const nodemask_t *from, const nodemask_t *to,
58 unsigned long flags)
59{
60 return -ENOSYS;
61}
62
290408d4
NH
63static inline void migrate_page_copy(struct page *newpage,
64 struct page *page) {}
65
6f39ce05 66static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
290408d4
NH
67 struct page *newpage, struct page *page)
68{
69 return -ENOSYS;
70}
71
b20a3503
CL
72/* Possible settings for the migrate_page() method in address_operations */
73#define migrate_page NULL
74#define fail_migrate_page NULL
75
76#endif /* CONFIG_MIGRATION */
7039e1db
PZ
77
78#ifdef CONFIG_NUMA_BALANCING
79extern int migrate_misplaced_page(struct page *page, int node);
e14808b4
MG
80extern int migrate_misplaced_page(struct page *page, int node);
81extern bool migrate_ratelimited(int node);
7039e1db
PZ
82#else
83static inline int migrate_misplaced_page(struct page *page, int node)
84{
85 return -EAGAIN; /* can't migrate now */
86}
e14808b4
MG
87static inline bool migrate_ratelimited(int node)
88{
89 return false;
90}
7039e1db
PZ
91#endif /* CONFIG_NUMA_BALANCING */
92
b20a3503 93#endif /* _LINUX_MIGRATE_H */