lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 5 Oct 2022 12:01:57 +0300 From: Alexander Atanasov <alexander.atanasov@...tuozzo.com> To: "K. Y. Srinivasan" <kys@...rosoft.com>, Haiyang Zhang <haiyangz@...rosoft.com>, Stephen Hemminger <sthemmin@...rosoft.com>, Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com> Cc: kernel@...nvz.org, Alexander Atanasov <alexander.atanasov@...tuozzo.com>, linux-hyperv@...r.kernel.org, linux-kernel@...r.kernel.org Subject: [PATCH v4 7/7] drivers: hyperv: balloon - report inflated memory Propagate inflated memory changes to mm. Signed-off-by: Alexander Atanasov <alexander.atanasov@...tuozzo.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 fdf6decacf06..b4c828c462a4 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -24,6 +24,7 @@ #include <linux/notifier.h> #include <linux/percpu_counter.h> #include <linux/page_reporting.h> +#include <linux/balloon.h> #include <linux/hyperv.h> #include <asm/hyperv-tlfs.h> @@ -1280,6 +1281,13 @@ static unsigned int alloc_balloon_pages(struct hv_dynmem_device *dm, return i * alloc_unit; } +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; @@ -1368,6 +1376,7 @@ static void balloon_up(struct work_struct *dummy) } } + report_ballooned_pages(&dm_device); } static void balloon_down(struct hv_dynmem_device *dm, @@ -1387,6 +1396,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
Powered by blists - more mailing lists