On Tue, Jul 05, 2022 at 08:36:37AM +0000, Alexander Atanasov wrote:....
Allow the guest to know how much it is ballooned by the host.
It is useful when debugging out of memory conditions.
When host gets back memory from the guest it is accounted
as used memory in the guest but the guest have no way to know
how much it is actually ballooned.
Signed-off-by: Alexander Atanasov <alexander.atanasov@xxxxxxxxxxxxx>
---
drivers/virtio/virtio_balloon.c | 77 +++++++++++++++++++++++++++++
include/uapi/linux/virtio_balloon.h | 1 +
2 files changed, 78 insertions(+)
V2:
- fixed coding style
- removed pretty print
V3:
- removed dublicate of features
- comment about balooned_pages more clear
- convert host pages to balloon pages
V4:
- added a define for BALLOON_PAGE_SIZE to make things clear
/* Size of a PFN in the balloon interface. */Did you run checkpatch on this?
#define VIRTIO_BALLOON_PFN_SHIFT 12
+#define VIRTIO_BALLOON_PAGE_SIZE (1<<VIRTIO_BALLOON_PFN_SHIFT)
#define VIRTIO_BALLOON_CMD_ID_STOP 0
#define VIRTIO_BALLOON_CMD_ID_DONE 1