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 | */ |
Roger Pau Monne | aecb201 | 2020-09-01 10:33:24 +0200 | [diff] [blame] | 5 | #ifndef _XEN_BALLOON_H |
| 6 | #define _XEN_BALLOON_H |
Daniel De Graaf | 803eb04 | 2011-03-14 11:29:37 -0400 | [diff] [blame] | 7 | |
| 8 | #define RETRY_UNLIMITED 0 |
| 9 | |
| 10 | struct balloon_stats { |
| 11 | /* We aim for 'current allocation' == 'target allocation'. */ |
| 12 | unsigned long current_pages; |
| 13 | unsigned long target_pages; |
David Vrabel | 1cf6a6c | 2015-06-25 16:29:18 +0100 | [diff] [blame] | 14 | unsigned long target_unpopulated; |
Daniel De Graaf | 803eb04 | 2011-03-14 11:29:37 -0400 | [diff] [blame] | 15 | /* Number of pages in high- and low-memory balloons. */ |
| 16 | unsigned long balloon_low; |
| 17 | unsigned long balloon_high; |
David Vrabel | de5a77d | 2015-06-25 12:08:20 +0100 | [diff] [blame] | 18 | unsigned long total_pages; |
Daniel De Graaf | 803eb04 | 2011-03-14 11:29:37 -0400 | [diff] [blame] | 19 | unsigned long schedule_delay; |
| 20 | unsigned long max_schedule_delay; |
| 21 | unsigned long retry_count; |
| 22 | unsigned long max_retry_count; |
| 23 | }; |
| 24 | |
| 25 | extern struct balloon_stats balloon_stats; |
| 26 | |
| 27 | void balloon_set_new_target(unsigned long target); |
Konrad Rzeszutek Wilk | b6f3067 | 2011-03-15 10:23:57 -0400 | [diff] [blame] | 28 | |
David Vrabel | 81b286e | 2015-06-25 13:12:46 +0100 | [diff] [blame] | 29 | int alloc_xenballooned_pages(int nr_pages, struct page **pages); |
Stefano Stabellini | 693394b | 2011-09-29 11:57:55 +0100 | [diff] [blame] | 30 | void free_xenballooned_pages(int nr_pages, struct page **pages); |
Dan Magenheimer | a50777c | 2011-07-08 12:26:21 -0600 | [diff] [blame] | 31 | |
Juergen Gross | 96edd61 | 2017-07-10 10:10:45 +0200 | [diff] [blame] | 32 | #ifdef CONFIG_XEN_BALLOON |
| 33 | void xen_balloon_init(void); |
| 34 | #else |
| 35 | static inline void xen_balloon_init(void) |
| 36 | { |
| 37 | } |
| 38 | #endif |
Roger Pau Monne | aecb201 | 2020-09-01 10:33:24 +0200 | [diff] [blame] | 39 | |
| 40 | #endif /* _XEN_BALLOON_H */ |