Propagate balloon stats to mm core.

https://jira.sw.ru/browse/PSBM-142436
Signed-off-by: Alexander Atanasov <alexander.atana...@virtuozzo.com>
---
 drivers/hv/hv_balloon.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 9bf30659a975..5faf5bfd62b1 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -32,6 +32,7 @@
 #include <linux/memory.h>
 #include <linux/notifier.h>
 #include <linux/percpu_counter.h>
+#include <linux/balloon_compaction.h>
 
 #include <linux/hyperv.h>
 #include <asm/mshyperv.h>
@@ -1280,6 +1281,13 @@ static unsigned int alloc_balloon_pages(struct 
hv_dynmem_device *dm,
        return num_pages;
 }
 
+static void report_ballooned_pages(struct hv_dynmem_device *dm)
+{
+       u32 actual = dm->num_pages_ballooned;
+       long inflated_kb = actual << (HV_HYP_PAGE_SHIFT - 10);
+
+       balloon_set_inflated_total(inflated_kb);
+}
+
 static void balloon_up(struct work_struct *dummy)
 {
        unsigned int num_pages = dm_device.balloon_wrk.num_pages;
@@ -1372,6 +1380,7 @@ static void balloon_up(struct work_struct *dummy)
                }
        }
 
+       report_ballooned_pages(&dm_device);
 }
 
 static void balloon_down(struct hv_dynmem_device *dm,
@@ -1391,6 +1400,8 @@ static void balloon_down(struct hv_dynmem_device *dm,
        pr_debug("Freed %u ballooned pages.\n",
                prev_pages_ballooned - dm->num_pages_ballooned);
 
+       report_ballooned_pages(dm);
+
        if (req->more_pages == 1)
                return;
 
-- 
2.31.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to