[Devel] [PATCH RHEL9 COMMIT] drivers/virtio: Balloon report stats to mm core

Konstantin Khorenko khorenko at virtuozzo.com
Mon Oct 17 16:11:54 MSK 2022


The commit is pushed to "branch-rh9-5.14.0-70.22.1.vz9.17.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-70.22.1.vz9.17.7
------>
commit 272c7e84959ce97f3260bdbaabdb7102a67f5a59
Author: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
Date:   Mon Oct 17 14:52:52 2022 +0300

    drivers/virtio: Balloon report stats to mm core
    
    Propagate balloon stats to mm core.
    
    https://jira.sw.ru/browse/PSBM-142436
    Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
    
    Feature: balloon: usage information visible by guest
---
 drivers/virtio/virtio_balloon.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 92bf87ef2e98..2b0cea09eed5 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -458,10 +458,15 @@ static void virtballoon_changed(struct virtio_device *vdev)
 static void update_balloon_size(struct virtio_balloon *vb)
 {
 	u32 actual = vb->num_pages;
+	long inflated_kb = actual << (VIRTIO_BALLOON_PFN_SHIFT - 10);
 
 	/* Legacy balloon config space is LE, unlike all other devices. */
 	virtio_cwrite_le(vb->vdev, struct virtio_balloon_config, actual,
 			 &actual);
+	if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
+		balloon_set_inflated_free(inflated_kb);
+	else
+		balloon_set_inflated_total(inflated_kb);
 }
 
 static void update_balloon_stats_func(struct work_struct *work)


More information about the Devel mailing list