blob: 4914b93a23f2bdeb066a4048d7ab749456ae3fe3 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Daniel De Graaf803eb042011-03-14 11:29:37 -04002/******************************************************************************
3 * Xen balloon functionality
4 */
5
6#define RETRY_UNLIMITED 0
7
8struct balloon_stats {
9 /* We aim for 'current allocation' == 'target allocation'. */
10 unsigned long current_pages;
11 unsigned long target_pages;
David Vrabel1cf6a6c2015-06-25 16:29:18 +010012 unsigned long target_unpopulated;
Daniel De Graaf803eb042011-03-14 11:29:37 -040013 /* Number of pages in high- and low-memory balloons. */
14 unsigned long balloon_low;
15 unsigned long balloon_high;
David Vrabelde5a77d2015-06-25 12:08:20 +010016 unsigned long total_pages;
Daniel De Graaf803eb042011-03-14 11:29:37 -040017 unsigned long schedule_delay;
18 unsigned long max_schedule_delay;
19 unsigned long retry_count;
20 unsigned long max_retry_count;
21};
22
23extern struct balloon_stats balloon_stats;
24
25void balloon_set_new_target(unsigned long target);
Konrad Rzeszutek Wilkb6f30672011-03-15 10:23:57 -040026
David Vrabel81b286e2015-06-25 13:12:46 +010027int alloc_xenballooned_pages(int nr_pages, struct page **pages);
Stefano Stabellini693394b2011-09-29 11:57:55 +010028void free_xenballooned_pages(int nr_pages, struct page **pages);
Dan Magenheimera50777c2011-07-08 12:26:21 -060029
Kay Sievers07068022011-12-14 15:32:50 -080030struct device;
Dan Magenheimera50777c2011-07-08 12:26:21 -060031#ifdef CONFIG_XEN_SELFBALLOONING
Kay Sievers07068022011-12-14 15:32:50 -080032extern int register_xen_selfballooning(struct device *dev);
Dan Magenheimera50777c2011-07-08 12:26:21 -060033#else
Kay Sievers07068022011-12-14 15:32:50 -080034static inline int register_xen_selfballooning(struct device *dev)
Dan Magenheimera50777c2011-07-08 12:26:21 -060035{
36 return -ENOSYS;
37}
38#endif
Juergen Gross96edd612017-07-10 10:10:45 +020039
40#ifdef CONFIG_XEN_BALLOON
41void xen_balloon_init(void);
42#else
43static inline void xen_balloon_init(void)
44{
45}
46#endif