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