page-isolation.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. struct page *alloc_migrate_target(struct page *page, unsigned long private,
  63. int **resultp);
  64. #endif