page-isolation.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __LINUX_PAGEISOLATION_H
  3. #define __LINUX_PAGEISOLATION_H
  4. #ifdef CONFIG_MEMORY_ISOLATION
  5. static inline bool has_isolate_pageblock(struct zone *zone)
  6. {
  7. return zone->nr_isolate_pageblock;
  8. }
  9. static inline bool is_migrate_isolate_page(struct page *page)
  10. {
  11. return get_pageblock_migratetype(page) == MIGRATE_ISOLATE;
  12. }
  13. static inline bool is_migrate_isolate(int migratetype)
  14. {
  15. return migratetype == MIGRATE_ISOLATE;
  16. }
  17. #else
  18. static inline bool has_isolate_pageblock(struct zone *zone)
  19. {
  20. return false;
  21. }
  22. static inline bool is_migrate_isolate_page(struct page *page)
  23. {
  24. return false;
  25. }
  26. static inline bool is_migrate_isolate(int migratetype)
  27. {
  28. return false;
  29. }
  30. #endif
  31. #define MEMORY_OFFLINE 0x1
  32. #define REPORT_FAILURE 0x2
  33. struct page *has_unmovable_pages(struct zone *zone, struct page *page,
  34. int migratetype, int flags);
  35. void set_pageblock_migratetype(struct page *page, int migratetype);
  36. int move_freepages_block(struct zone *zone, struct page *page,
  37. int migratetype, int *num_movable);
  38. /*
  39. * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE.
  40. */
  41. int
  42. start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
  43. unsigned migratetype, int flags,
  44. unsigned long *failed_pfn);
  45. /*
  46. * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE.
  47. * target range is [start_pfn, end_pfn)
  48. */
  49. void
  50. undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
  51. unsigned migratetype);
  52. /*
  53. * Test all pages in [start_pfn, end_pfn) are isolated or not.
  54. */
  55. int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn,
  56. int isol_flags, unsigned long *failed_pfn);
  57. struct page *alloc_migrate_target(struct page *page, unsigned long private);
  58. #endif