[Devel] [PATCH vz7 3/4] drivers: vmware: balloon report stats to mm core

Alexander Atanasov alexander.atanasov at virtuozzo.com
Wed Oct 5 13:25:30 MSK 2022


Propagate balloon stats to mm core.

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 = {
-- 
2.31.1



More information about the Devel mailing list