migrate.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef _LINUX_MIGRATE_H
  2. #define _LINUX_MIGRATE_H
  3. #include <linux/mm.h>
  4. #include <linux/mempolicy.h>
  5. #include <linux/migrate_mode.h>
  6. typedef struct page *new_page_t(struct page *, unsigned long private, int **);
  7. /*
  8. * Return values from addresss_space_operations.migratepage():
  9. * - negative errno on page migration failure;
  10. * - zero on page migration success;
  11. *
  12. * The balloon page migration introduces this special case where a 'distinct'
  13. * return code is used to flag a successful page migration to unmap_and_move().
  14. * This approach is necessary because page migration can race against balloon
  15. * deflation procedure, and for such case we could introduce a nasty page leak
  16. * if a successfully migrated balloon page gets released concurrently with
  17. * migration's unmap_and_move() wrap-up steps.
  18. */
  19. #define MIGRATEPAGE_SUCCESS 0
  20. #define MIGRATEPAGE_BALLOON_SUCCESS 1 /* special ret code for balloon page
  21. * sucessful migration case.
  22. */
  23. #ifdef CONFIG_MIGRATION
  24. extern void putback_lru_pages(struct list_head *l);
  25. extern void putback_movable_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);
  31. extern int migrate_huge_page(struct page *, new_page_t x,
  32. unsigned long private, bool offlining,
  33. enum migrate_mode mode);
  34. extern int fail_migrate_page(struct address_space *,
  35. struct page *, struct page *);
  36. extern int migrate_prep(void);
  37. extern int migrate_prep_local(void);
  38. extern int migrate_vmas(struct mm_struct *mm,
  39. const nodemask_t *from, const nodemask_t *to,
  40. unsigned long flags);
  41. extern void migrate_page_copy(struct page *newpage, struct page *page);
  42. extern int migrate_huge_page_move_mapping(struct address_space *mapping,
  43. struct page *newpage, struct page *page);
  44. #else
  45. static inline void putback_lru_pages(struct list_head *l) {}
  46. static inline void putback_movable_pages(struct list_head *l) {}
  47. static inline int migrate_pages(struct list_head *l, new_page_t x,
  48. unsigned long private, bool offlining,
  49. enum migrate_mode mode) { return -ENOSYS; }
  50. static inline int migrate_huge_page(struct page *page, new_page_t x,
  51. unsigned long private, bool offlining,
  52. enum migrate_mode mode) { return -ENOSYS; }
  53. static inline int migrate_prep(void) { return -ENOSYS; }
  54. static inline int migrate_prep_local(void) { return -ENOSYS; }
  55. static inline int migrate_vmas(struct mm_struct *mm,
  56. const nodemask_t *from, const nodemask_t *to,
  57. unsigned long flags)
  58. {
  59. return -ENOSYS;
  60. }
  61. static inline void migrate_page_copy(struct page *newpage,
  62. struct page *page) {}
  63. static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
  64. struct page *newpage, struct page *page)
  65. {
  66. return -ENOSYS;
  67. }
  68. /* Possible settings for the migrate_page() method in address_operations */
  69. #define migrate_page NULL
  70. #define fail_migrate_page NULL
  71. #endif /* CONFIG_MIGRATION */
  72. #endif /* _LINUX_MIGRATE_H */