page-isolation.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef __LINUX_PAGEISOLATION_H
  2. #define __LINUX_PAGEISOLATION_H
  3. #ifdef CONFIG_MEMORY_ISOLATION
  4. static inline bool has_isolate_pageblock(struct zone *zone)
  5. {
  6. return zone->nr_isolate_pageblock;
  7. }
  8. static inline bool is_migrate_isolate_page(struct page *page)
  9. {
  10. return get_pageblock_migratetype(page) == MIGRATE_ISOLATE;
  11. }
  12. static inline bool is_migrate_isolate(int migratetype)
  13. {
  14. return migratetype == MIGRATE_ISOLATE;
  15. }
  16. #else
  17. static inline bool has_isolate_pageblock(struct zone *zone)
  18. {
  19. return false;
  20. }
  21. static inline bool is_migrate_isolate_page(struct page *page)
  22. {
  23. return false;
  24. }
  25. static inline bool is_migrate_isolate(int migratetype)
  26. {
  27. return false;
  28. }
  29. #endif
  30. bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
  31. bool skip_hwpoisoned_pages);
  32. void set_pageblock_migratetype(struct page *page, int migratetype);
  33. int move_freepages_block(struct zone *zone, struct page *page,
  34. int migratetype);
  35. int move_freepages(struct zone *zone,
  36. struct page *start_page, struct page *end_page,
  37. int migratetype);
  38. /*
  39. * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE.
  40. * If specified range includes migrate types other than MOVABLE or CMA,
  41. * this will fail with -EBUSY.
  42. *
  43. * For isolating all pages in the range finally, the caller have to
  44. * free all pages in the range. test_page_isolated() can be used for
  45. * test it.
  46. */
  47. int
  48. start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
  49. unsigned migratetype, bool skip_hwpoisoned_pages);
  50. /*
  51. * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE.
  52. * target range is [start_pfn, end_pfn)
  53. */
  54. int
  55. undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
  56. unsigned migratetype);
  57. /*
  58. * Test all pages in [start_pfn, end_pfn) are isolated or not.
  59. */
  60. int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn,
  61. bool skip_hwpoisoned_pages);
  62. /*
  63. * Internal functions. Changes pageblock's migrate type.
  64. */
  65. int set_migratetype_isolate(struct page *page, bool skip_hwpoisoned_pages);
  66. void unset_migratetype_isolate(struct page *page, unsigned migratetype);
  67. struct page *alloc_migrate_target(struct page *page, unsigned long private,
  68. int **resultp);
  69. #endif