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

Konstantin Khorenko khorenko at virtuozzo.com
Mon Oct 17 13:39:22 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 efd1f2f29608d82194709e8b5a839d883c913920
Author: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
Date:   Wed Oct 5 13:25:30 2022 +0300

    drivers/vmware: Balloon report stats to mm core
    
    Propagate balloon stats to mm core.
    
    VMware balloon driver makes ballooned pages accounted as "used" in the
    guest OS, thus propagating the "InflatedFree" counter to mm.
    
    https://jira.sw.ru/browse/PSBM-142436
    
    Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
 drivers/misc/vmw_balloon.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index 981f47f400ae..5bb579cde2e6 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -43,6 +43,7 @@
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
 #include <asm/hypervisor.h>
+#include <linux/balloon_compaction.h>
 
 MODULE_AUTHOR("VMware, Inc.");
 MODULE_DESCRIPTION("VMware Memory Control (Balloon) Driver");
@@ -916,6 +917,7 @@ static void vmballoon_inflate(struct vmballoon *b)
 
 	vmballoon_release_refused_pages(b, true);
 	vmballoon_release_refused_pages(b, false);
+	balloon_set_inflated_free(atomic64_read(&b->size) << 2);
 }
 
 /*
@@ -952,8 +954,10 @@ static void vmballoon_deflate(struct vmballoon *b)
 				error = b->ops->unlock(b, num_pages,
 						is_2m_pages, &b->target);
 				num_pages = 0;
-				if (error)
+				if (error) {
+					balloon_set_inflated_free(atomic64_read(&b->size) << 2);
 					return;
+				}
 			}
 
 			cond_resched();
@@ -962,6 +966,7 @@ static void vmballoon_deflate(struct vmballoon *b)
 		if (num_pages > 0)
 			b->ops->unlock(b, num_pages, is_2m_pages, &b->target);
 	}
+	balloon_set_inflated_free(atomic64_read(&b->size) << 2);
 }
 
 static const struct vmballoon_ops vmballoon_basic_ops = {


More information about the Devel mailing list