xref: /linux/include/xen/balloon.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2803eb047SDaniel De Graaf /******************************************************************************
3803eb047SDaniel De Graaf  * Xen balloon functionality
4803eb047SDaniel De Graaf  */
5aecb2016SRoger Pau Monne #ifndef _XEN_BALLOON_H
6aecb2016SRoger Pau Monne #define _XEN_BALLOON_H
7803eb047SDaniel De Graaf 
8803eb047SDaniel De Graaf #define RETRY_UNLIMITED	0
9803eb047SDaniel De Graaf 
10803eb047SDaniel De Graaf struct balloon_stats {
11803eb047SDaniel De Graaf 	/* We aim for 'current allocation' == 'target allocation'. */
12803eb047SDaniel De Graaf 	unsigned long current_pages;
13803eb047SDaniel De Graaf 	unsigned long target_pages;
141cf6a6c8SDavid Vrabel 	unsigned long target_unpopulated;
15803eb047SDaniel De Graaf 	/* Number of pages in high- and low-memory balloons. */
16803eb047SDaniel De Graaf 	unsigned long balloon_low;
17803eb047SDaniel De Graaf 	unsigned long balloon_high;
18de5a77d8SDavid Vrabel 	unsigned long total_pages;
19803eb047SDaniel De Graaf 	unsigned long schedule_delay;
20803eb047SDaniel De Graaf 	unsigned long max_schedule_delay;
21803eb047SDaniel De Graaf 	unsigned long retry_count;
22803eb047SDaniel De Graaf 	unsigned long max_retry_count;
23803eb047SDaniel De Graaf };
24803eb047SDaniel De Graaf 
25803eb047SDaniel De Graaf extern struct balloon_stats balloon_stats;
26803eb047SDaniel De Graaf 
27803eb047SDaniel De Graaf void balloon_set_new_target(unsigned long target);
28b6f30679SKonrad Rzeszutek Wilk 
29*9dd060afSOleksandr Tyshchenko int xen_alloc_ballooned_pages(unsigned int nr_pages, struct page **pages);
30*9dd060afSOleksandr Tyshchenko void xen_free_ballooned_pages(unsigned int nr_pages, struct page **pages);
31*9dd060afSOleksandr Tyshchenko 
3296edd61dSJuergen Gross #ifdef CONFIG_XEN_BALLOON
3396edd61dSJuergen Gross void xen_balloon_init(void);
3496edd61dSJuergen Gross #else
xen_balloon_init(void)3596edd61dSJuergen Gross static inline void xen_balloon_init(void)
3696edd61dSJuergen Gross {
3796edd61dSJuergen Gross }
3896edd61dSJuergen Gross #endif
39aecb2016SRoger Pau Monne 
40aecb2016SRoger Pau Monne #endif	/* _XEN_BALLOON_H */
41