blob: 6dbdb0b3fd03da472d017c413f5481fb977f88bc [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
David Vrabel81b286e2015-06-25 13:12:46 +010029int alloc_xenballooned_pages(int nr_pages, struct page **pages);
Stefano Stabellini693394b2011-09-29 11:57:55 +010030void free_xenballooned_pages(int nr_pages, struct page **pages);
Dan Magenheimera50777c2011-07-08 12:26:21 -060031
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 */