blob: f78a6cc94f1aea9ae4508dc6c9ec4fde02d18885 [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 */
Roger Pau Monneaecb2012020-09-01 10:33:24 +02005#ifndef _XEN_BALLOON_H
6#define _XEN_BALLOON_H
Daniel De Graaf803eb042011-03-14 11:29:37 -04007
8#define RETRY_UNLIMITED 0
9
10struct balloon_stats {
11 /* We aim for 'current allocation' == 'target allocation'. */
12 unsigned long current_pages;
13 unsigned long target_pages;
David Vrabel1cf6a6c2015-06-25 16:29:18 +010014 unsigned long target_unpopulated;
Daniel De Graaf803eb042011-03-14 11:29:37 -040015 /* Number of pages in high- and low-memory balloons. */
16 unsigned long balloon_low;
17 unsigned long balloon_high;
David Vrabelde5a77d2015-06-25 12:08:20 +010018 unsigned long total_pages;
Daniel De Graaf803eb042011-03-14 11:29:37 -040019 unsigned long schedule_delay;
20 unsigned long max_schedule_delay;
21 unsigned long retry_count;
22 unsigned long max_retry_count;
23};
24
25extern struct balloon_stats balloon_stats;
26
27void balloon_set_new_target(unsigned long target);
Konrad Rzeszutek Wilkb6f30672011-03-15 10:23:57 -040028
Oleksandr Tyshchenko9dd060a2021-12-09 22:05:33 +020029int xen_alloc_ballooned_pages(unsigned int nr_pages, struct page **pages);
30void xen_free_ballooned_pages(unsigned int nr_pages, struct page **pages);
31
Juergen Gross96edd612017-07-10 10:10:45 +020032#ifdef CONFIG_XEN_BALLOON
33void xen_balloon_init(void);
34#else
35static inline void xen_balloon_init(void)
36{
37}
38#endif
Roger Pau Monneaecb2012020-09-01 10:33:24 +020039
40#endif /* _XEN_BALLOON_H */