b24413180f560 (Greg Kroah-Hartman 2017-11-01 15:07:57 +0100 1) /* SPDX-License-Identifier: GPL-2.0 */
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 2) /******************************************************************************
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 3) * Xen balloon functionality
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 4) */
aecb2016c90a1 (Roger Pau Monne 2020-09-01 10:33:24 +0200 5) #ifndef _XEN_BALLOON_H
aecb2016c90a1 (Roger Pau Monne 2020-09-01 10:33:24 +0200 6) #define _XEN_BALLOON_H
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 7)
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 8) #define RETRY_UNLIMITED 0
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 9)
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 10) struct balloon_stats {
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 11) /* We aim for 'current allocation' == 'target allocation'. */
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 12) unsigned long current_pages;
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 13) unsigned long target_pages;
1cf6a6c82918c (David Vrabel 2015-06-25 16:29:18 +0100 14) unsigned long target_unpopulated;
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 15) /* Number of pages in high- and low-memory balloons. */
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 16) unsigned long balloon_low;
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 17) unsigned long balloon_high;
de5a77d8422fc (David Vrabel 2015-06-25 12:08:20 +0100 18) unsigned long total_pages;
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 19) unsigned long schedule_delay;
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 20) unsigned long max_schedule_delay;
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 21) unsigned long retry_count;
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 22) unsigned long max_retry_count;
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 23) };
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 24)
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 25) extern struct balloon_stats balloon_stats;
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 26)
803eb047a28d2 (Daniel De Graaf 2011-03-14 11:29:37 -0400 27) void balloon_set_new_target(unsigned long target);
b6f3067985f12 (Konrad Rzeszutek Wilk 2011-03-15 10:23:57 -0400 28)
81b286e0f1fe5 (David Vrabel 2015-06-25 13:12:46 +0100 29) int alloc_xenballooned_pages(int nr_pages, struct page **pages);
693394b8c3dce (Stefano Stabellini 2011-09-29 11:57:55 +0100 30) void free_xenballooned_pages(int nr_pages, struct page **pages);
a50777c791031 (Dan Magenheimer 2011-07-08 12:26:21 -0600 31)
96edd61dcf443 (Juergen Gross 2017-07-10 10:10:45 +0200 32) #ifdef CONFIG_XEN_BALLOON
96edd61dcf443 (Juergen Gross 2017-07-10 10:10:45 +0200 33) void xen_balloon_init(void);
96edd61dcf443 (Juergen Gross 2017-07-10 10:10:45 +0200 34) #else
96edd61dcf443 (Juergen Gross 2017-07-10 10:10:45 +0200 35) static inline void xen_balloon_init(void)
96edd61dcf443 (Juergen Gross 2017-07-10 10:10:45 +0200 36) {
96edd61dcf443 (Juergen Gross 2017-07-10 10:10:45 +0200 37) }
96edd61dcf443 (Juergen Gross 2017-07-10 10:10:45 +0200 38) #endif
aecb2016c90a1 (Roger Pau Monne 2020-09-01 10:33:24 +0200 39)
aecb2016c90a1 (Roger Pau Monne 2020-09-01 10:33:24 +0200 40) #endif /* _XEN_BALLOON_H */