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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
 <SN6PR02MB4157924B97EF67299E751082D4DD2@SN6PR02MB4157.namprd02.prod.outlook.com>
Date: Sat, 15 Mar 2025 04:09:25 +0000
From: Michael Kelley <mhklinux@...look.com>
To: Nico Pache <npache@...hat.com>, "linux-hyperv@...r.kernel.org"
	<linux-hyperv@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "xen-devel@...ts.xenproject.org"
	<xen-devel@...ts.xenproject.org>, "linux-fsdevel@...r.kernel.org"
	<linux-fsdevel@...r.kernel.org>, "linux-mm@...ck.org" <linux-mm@...ck.org>,
	"virtualization@...ts.linux.dev" <virtualization@...ts.linux.dev>
CC: "alexander.atanasov@...tuozzo.com" <alexander.atanasov@...tuozzo.com>,
	"muchun.song@...ux.dev" <muchun.song@...ux.dev>, "roman.gushchin@...ux.dev"
	<roman.gushchin@...ux.dev>, "mhocko@...nel.org" <mhocko@...nel.org>,
	"kys@...rosoft.com" <kys@...rosoft.com>, "haiyangz@...rosoft.com"
	<haiyangz@...rosoft.com>, "wei.liu@...nel.org" <wei.liu@...nel.org>,
	"decui@...rosoft.com" <decui@...rosoft.com>, "jgross@...e.com"
	<jgross@...e.com>, "sstabellini@...nel.org" <sstabellini@...nel.org>,
	"oleksandr_tyshchenko@...m.com" <oleksandr_tyshchenko@...m.com>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>, "mst@...hat.com"
	<mst@...hat.com>, "david@...hat.com" <david@...hat.com>,
	"yosry.ahmed@...ux.dev" <yosry.ahmed@...ux.dev>, "hannes@...xchg.org"
	<hannes@...xchg.org>, "nphamcs@...il.com" <nphamcs@...il.com>,
	"chengming.zhou@...ux.dev" <chengming.zhou@...ux.dev>,
	"kanchana.p.sridhar@...el.com" <kanchana.p.sridhar@...el.com>,
	"llong@...hat.com" <llong@...hat.com>, "shakeel.butt@...ux.dev"
	<shakeel.butt@...ux.dev>
Subject: RE: [PATCH v2 3/4] hv_balloon: update the NR_BALLOON_PAGES state

From: Nico Pache <npache@...hat.com> Sent: Friday, March 14, 2025 2:38 PM
> 
> Update the NR_BALLOON_PAGES counter when pages are added to or
> removed from the Hyper-V balloon.
> 
> Signed-off-by: Nico Pache <npache@...hat.com>
> ---
>  drivers/hv/hv_balloon.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
> index fec2f18679e3..2b4080e51f97 100644
> --- a/drivers/hv/hv_balloon.c
> +++ b/drivers/hv/hv_balloon.c
> @@ -1192,6 +1192,7 @@ static void free_balloon_pages(struct hv_dynmem_device *dm,
>  		__ClearPageOffline(pg);
>  		__free_page(pg);
>  		dm->num_pages_ballooned--;
> +		mod_node_page_state(page_pgdat(pg), NR_BALLOON_PAGES, -1);
>  		adjust_managed_page_count(pg, 1);
>  	}
>  }
> @@ -1221,6 +1222,7 @@ static unsigned int alloc_balloon_pages(struct hv_dynmem_device *dm,
>  			return i * alloc_unit;
> 
>  		dm->num_pages_ballooned += alloc_unit;
> +		mod_node_page_state(page_pgdat(pg), NR_BALLOON_PAGES, alloc_unit);
> 
>  		/*
>  		 * If we allocatted 2M pages; split them so we
> --
> 2.48.1
> 

As is evident from the code, the hv_balloon driver already has accounting
for the number of pages that have been ballooned out of the VM. This
accounting and other details of the hv_balloon driver state is available in
/sys/kernel/debug/hv-balloon when CONFIG_DEBUGFS=y. But it seems OK
to also report the # of pages ballooned through /proc/meminfo, which
works even if CONFIG_DEBUGFS=n.

Reviewed-by: Michael Kelley <mhklinux@...look.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ