2006-03-22 16:09:12 +08:00
|
|
|
#ifndef _LINUX_MIGRATE_H
|
|
|
|
#define _LINUX_MIGRATE_H
|
|
|
|
|
|
|
|
#include <linux/mm.h>
|
2007-05-07 05:50:20 +08:00
|
|
|
#include <linux/mempolicy.h>
|
2012-01-21 06:33:53 +08:00
|
|
|
#include <linux/migrate_mode.h>
|
2006-03-22 16:09:12 +08:00
|
|
|
|
2014-06-05 07:08:25 +08:00
|
|
|
typedef struct page *new_page_t(struct page *page, unsigned long private,
|
|
|
|
int **reason);
|
|
|
|
typedef void free_page_t(struct page *page, unsigned long private);
|
2006-06-23 17:03:53 +08:00
|
|
|
|
2012-12-12 08:02:31 +08:00
|
|
|
/*
|
|
|
|
* Return values from addresss_space_operations.migratepage():
|
|
|
|
* - negative errno on page migration failure;
|
|
|
|
* - zero on page migration success;
|
|
|
|
*/
|
|
|
|
#define MIGRATEPAGE_SUCCESS 0
|
2014-10-10 06:29:27 +08:00
|
|
|
|
2012-10-19 21:07:31 +08:00
|
|
|
enum migrate_reason {
|
|
|
|
MR_COMPACTION,
|
|
|
|
MR_MEMORY_FAILURE,
|
|
|
|
MR_MEMORY_HOTPLUG,
|
|
|
|
MR_SYSCALL, /* also applies to cpusets */
|
|
|
|
MR_MEMPOLICY_MBIND,
|
2012-10-25 20:16:34 +08:00
|
|
|
MR_NUMA_MISPLACED,
|
2012-10-19 21:07:31 +08:00
|
|
|
MR_CMA
|
|
|
|
};
|
2012-12-12 08:02:31 +08:00
|
|
|
|
2007-05-07 05:50:20 +08:00
|
|
|
#ifdef CONFIG_MIGRATION
|
2009-01-07 06:39:16 +08:00
|
|
|
|
2012-12-12 08:02:47 +08:00
|
|
|
extern void putback_movable_pages(struct list_head *l);
|
2006-06-23 17:03:33 +08:00
|
|
|
extern int migrate_page(struct address_space *,
|
2012-01-13 09:19:43 +08:00
|
|
|
struct page *, struct page *, enum migrate_mode);
|
2014-06-05 07:08:25 +08:00
|
|
|
extern int migrate_pages(struct list_head *l, new_page_t new, free_page_t free,
|
2013-02-23 08:35:14 +08:00
|
|
|
unsigned long private, enum migrate_mode mode, int reason);
|
2006-06-23 17:03:53 +08:00
|
|
|
|
2006-03-22 16:09:12 +08:00
|
|
|
extern int migrate_prep(void);
|
2010-05-25 05:32:27 +08:00
|
|
|
extern int migrate_prep_local(void);
|
2010-09-08 09:19:35 +08:00
|
|
|
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);
|
2013-07-16 17:56:16 +08:00
|
|
|
extern int migrate_page_move_mapping(struct address_space *mapping,
|
|
|
|
struct page *newpage, struct page *page,
|
2013-12-22 06:56:08 +08:00
|
|
|
struct buffer_head *head, enum migrate_mode mode,
|
|
|
|
int extra_count);
|
2006-03-22 16:09:12 +08:00
|
|
|
#else
|
2009-01-07 06:39:16 +08:00
|
|
|
|
2012-12-12 08:02:47 +08:00
|
|
|
static inline void putback_movable_pages(struct list_head *l) {}
|
2014-06-05 07:08:25 +08:00
|
|
|
static inline int migrate_pages(struct list_head *l, new_page_t new,
|
|
|
|
free_page_t free, unsigned long private, enum migrate_mode mode,
|
|
|
|
int reason)
|
2013-02-23 08:35:14 +08:00
|
|
|
{ return -ENOSYS; }
|
2006-03-31 18:29:56 +08:00
|
|
|
|
2006-03-22 16:09:12 +08:00
|
|
|
static inline int migrate_prep(void) { return -ENOSYS; }
|
2010-05-25 05:32:27 +08:00
|
|
|
static inline int migrate_prep_local(void) { return -ENOSYS; }
|
2006-03-22 16:09:12 +08:00
|
|
|
|
2010-09-08 09:19:35 +08:00
|
|
|
static inline void migrate_page_copy(struct page *newpage,
|
|
|
|
struct page *page) {}
|
|
|
|
|
2010-09-30 10:54:51 +08:00
|
|
|
static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
|
2010-09-08 09:19:35 +08:00
|
|
|
struct page *newpage, struct page *page)
|
|
|
|
{
|
|
|
|
return -ENOSYS;
|
|
|
|
}
|
|
|
|
|
2006-03-22 16:09:12 +08:00
|
|
|
#endif /* CONFIG_MIGRATION */
|
2012-10-25 20:16:34 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_NUMA_BALANCING
|
2013-12-19 09:08:42 +08:00
|
|
|
extern bool pmd_trans_migrating(pmd_t pmd);
|
2013-10-07 18:29:05 +08:00
|
|
|
extern int migrate_misplaced_page(struct page *page,
|
|
|
|
struct vm_area_struct *vma, int node);
|
2012-11-19 18:59:15 +08:00
|
|
|
extern bool migrate_ratelimited(int node);
|
2012-10-25 20:16:34 +08:00
|
|
|
#else
|
2013-12-19 09:08:42 +08:00
|
|
|
static inline bool pmd_trans_migrating(pmd_t pmd)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2013-10-07 18:29:05 +08:00
|
|
|
static inline int migrate_misplaced_page(struct page *page,
|
|
|
|
struct vm_area_struct *vma, int node)
|
2012-10-25 20:16:34 +08:00
|
|
|
{
|
|
|
|
return -EAGAIN; /* can't migrate now */
|
|
|
|
}
|
2012-11-19 18:59:15 +08:00
|
|
|
static inline bool migrate_ratelimited(int node)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2012-12-05 17:32:56 +08:00
|
|
|
#endif /* CONFIG_NUMA_BALANCING */
|
2012-11-19 20:35:47 +08:00
|
|
|
|
2012-12-05 17:32:56 +08:00
|
|
|
#if defined(CONFIG_NUMA_BALANCING) && defined(CONFIG_TRANSPARENT_HUGEPAGE)
|
|
|
|
extern int migrate_misplaced_transhuge_page(struct mm_struct *mm,
|
|
|
|
struct vm_area_struct *vma,
|
|
|
|
pmd_t *pmd, pmd_t entry,
|
|
|
|
unsigned long address,
|
|
|
|
struct page *page, int node);
|
|
|
|
#else
|
2012-11-19 20:35:47 +08:00
|
|
|
static inline int migrate_misplaced_transhuge_page(struct mm_struct *mm,
|
|
|
|
struct vm_area_struct *vma,
|
|
|
|
pmd_t *pmd, pmd_t entry,
|
|
|
|
unsigned long address,
|
|
|
|
struct page *page, int node)
|
|
|
|
{
|
|
|
|
return -EAGAIN;
|
|
|
|
}
|
2012-12-05 17:32:56 +08:00
|
|
|
#endif /* CONFIG_NUMA_BALANCING && CONFIG_TRANSPARENT_HUGEPAGE*/
|
2012-10-25 20:16:34 +08:00
|
|
|
|
2006-03-22 16:09:12 +08:00
|
|
|
#endif /* _LINUX_MIGRATE_H */
|