balloon.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /******************************************************************************
  3. * Xen balloon functionality
  4. */
  5. #define RETRY_UNLIMITED 0
  6. struct balloon_stats {
  7. /* We aim for 'current allocation' == 'target allocation'. */
  8. unsigned long current_pages;
  9. unsigned long target_pages;
  10. unsigned long target_unpopulated;
  11. /* Number of pages in high- and low-memory balloons. */
  12. unsigned long balloon_low;
  13. unsigned long balloon_high;
  14. unsigned long total_pages;
  15. unsigned long schedule_delay;
  16. unsigned long max_schedule_delay;
  17. unsigned long retry_count;
  18. unsigned long max_retry_count;
  19. };
  20. extern struct balloon_stats balloon_stats;
  21. void balloon_set_new_target(unsigned long target);
  22. int alloc_xenballooned_pages(int nr_pages, struct page **pages);
  23. void free_xenballooned_pages(int nr_pages, struct page **pages);
  24. struct device;
  25. #ifdef CONFIG_XEN_SELFBALLOONING
  26. extern int register_xen_selfballooning(struct device *dev);
  27. #else
  28. static inline int register_xen_selfballooning(struct device *dev)
  29. {
  30. return -ENOSYS;
  31. }
  32. #endif
  33. #ifdef CONFIG_XEN_BALLOON
  34. void xen_balloon_init(void);
  35. #else
  36. static inline void xen_balloon_init(void)
  37. {
  38. }
  39. #endif