xref: /linux/include/xen/balloon.h (revision aecb2016c90a1b620e21c9e143afbdc9666cce52)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2803eb047SDaniel De Graaf /******************************************************************************
3803eb047SDaniel De Graaf  * Xen balloon functionality
4803eb047SDaniel De Graaf  */
5*aecb2016SRoger Pau Monne #ifndef _XEN_BALLOON_H
6*aecb2016SRoger 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 
2981b286e0SDavid Vrabel int alloc_xenballooned_pages(int nr_pages, struct page **pages);
30b6f30679SKonrad Rzeszutek Wilk void free_xenballooned_pages(int nr_pages, struct page **pages);
31a50777c7SDan Magenheimer 
3296edd61dSJuergen Gross #ifdef CONFIG_XEN_BALLOON
3396edd61dSJuergen Gross void xen_balloon_init(void);
3496edd61dSJuergen Gross #else
3596edd61dSJuergen Gross static inline void xen_balloon_init(void)
3696edd61dSJuergen Gross {
3796edd61dSJuergen Gross }
3896edd61dSJuergen Gross #endif
39*aecb2016SRoger Pau Monne 
40*aecb2016SRoger Pau Monne #endif	/* _XEN_BALLOON_H */
41