Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Daniel De Graaf | 803eb04 | 2011-03-14 11:29:37 -0400 | [diff] [blame] | 2 | /****************************************************************************** |
| 3 | * Xen balloon functionality |
| 4 | */ |
| 5 | |
| 6 | #define RETRY_UNLIMITED 0 |
| 7 | |
| 8 | struct balloon_stats { |
| 9 | /* We aim for 'current allocation' == 'target allocation'. */ |
| 10 | unsigned long current_pages; |
| 11 | unsigned long target_pages; |
David Vrabel | 1cf6a6c | 2015-06-25 16:29:18 +0100 | [diff] [blame] | 12 | unsigned long target_unpopulated; |
Daniel De Graaf | 803eb04 | 2011-03-14 11:29:37 -0400 | [diff] [blame] | 13 | /* Number of pages in high- and low-memory balloons. */ |
| 14 | unsigned long balloon_low; |
| 15 | unsigned long balloon_high; |
David Vrabel | de5a77d | 2015-06-25 12:08:20 +0100 | [diff] [blame] | 16 | unsigned long total_pages; |
Daniel De Graaf | 803eb04 | 2011-03-14 11:29:37 -0400 | [diff] [blame] | 17 | unsigned long schedule_delay; |
| 18 | unsigned long max_schedule_delay; |
| 19 | unsigned long retry_count; |
| 20 | unsigned long max_retry_count; |
| 21 | }; |
| 22 | |
| 23 | extern struct balloon_stats balloon_stats; |
| 24 | |
| 25 | void balloon_set_new_target(unsigned long target); |
Konrad Rzeszutek Wilk | b6f3067 | 2011-03-15 10:23:57 -0400 | [diff] [blame] | 26 | |
David Vrabel | 81b286e | 2015-06-25 13:12:46 +0100 | [diff] [blame] | 27 | int alloc_xenballooned_pages(int nr_pages, struct page **pages); |
Stefano Stabellini | 693394b | 2011-09-29 11:57:55 +0100 | [diff] [blame] | 28 | void free_xenballooned_pages(int nr_pages, struct page **pages); |
Dan Magenheimer | a50777c | 2011-07-08 12:26:21 -0600 | [diff] [blame] | 29 | |
Kay Sievers | 0706802 | 2011-12-14 15:32:50 -0800 | [diff] [blame] | 30 | struct device; |
Dan Magenheimer | a50777c | 2011-07-08 12:26:21 -0600 | [diff] [blame] | 31 | #ifdef CONFIG_XEN_SELFBALLOONING |
Kay Sievers | 0706802 | 2011-12-14 15:32:50 -0800 | [diff] [blame] | 32 | extern int register_xen_selfballooning(struct device *dev); |
Dan Magenheimer | a50777c | 2011-07-08 12:26:21 -0600 | [diff] [blame] | 33 | #else |
Kay Sievers | 0706802 | 2011-12-14 15:32:50 -0800 | [diff] [blame] | 34 | static inline int register_xen_selfballooning(struct device *dev) |
Dan Magenheimer | a50777c | 2011-07-08 12:26:21 -0600 | [diff] [blame] | 35 | { |
| 36 | return -ENOSYS; |
| 37 | } |
| 38 | #endif |
Juergen Gross | 96edd61 | 2017-07-10 10:10:45 +0200 | [diff] [blame] | 39 | |
| 40 | #ifdef CONFIG_XEN_BALLOON |
| 41 | void xen_balloon_init(void); |
| 42 | #else |
| 43 | static inline void xen_balloon_init(void) |
| 44 | { |
| 45 | } |
| 46 | #endif |