page-isolation.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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, int *num_movable);
  35. /*
  36. * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE.
  37. * If specified range includes migrate types other than MOVABLE or CMA,
  38. * this will fail with -EBUSY.
  39. *
  40. * For isolating all pages in the range finally, the caller have to
  41. * free all pages in the range. test_page_isolated() can be used for
  42. * test it.
  43. */
  44. int
  45. start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
  46. unsigned migratetype, bool skip_hwpoisoned_pages);
  47. /*
  48. * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE.
  49. * target range is [start_pfn, end_pfn)
  50. */
  51. int
  52. undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
  53. unsigned migratetype);
  54. /*
  55. * Test all pages in [start_pfn, end_pfn) are isolated or not.
  56. */
  57. int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn,
  58. bool skip_hwpoisoned_pages);
  59. struct page *alloc_migrate_target(struct page *page, unsigned long private,
  60. int **resultp);
  61. #endif