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

Konstantin Khorenko khorenko at virtuozzo.com
Mon Oct 17 13:31:05 MSK 2022


The commit is pushed to "branch-rh7-3.10.0-1160.76.1.vz7.189.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.76.1.vz7.189.4
------>
commit b69fd71111db5a4970f2c640954522e86de6bf1f
Author: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
Date:   Wed Oct 5 13:25:29 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>
---
 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 e8cefeea4f22..8c2a03e2be44 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -341,6 +341,7 @@ static inline s64 towards_target(struct virtio_balloon *vb)
 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. */
 	if (!virtio_has_feature(vb->vdev, VIRTIO_F_VERSION_1))
@@ -348,6 +349,10 @@ static void update_balloon_size(struct virtio_balloon *vb)
 
 	virtio_cwrite(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);
 }
 
 /*


More information about the Devel mailing list