[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v2 3/4] hv_balloon: update the NR_BALLOON_PAGES state
- To: Nico Pache <npache@xxxxxxxxxx>, "linux-hyperv@xxxxxxxxxxxxxxx" <linux-hyperv@xxxxxxxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "linux-fsdevel@xxxxxxxxxxxxxxx" <linux-fsdevel@xxxxxxxxxxxxxxx>, "linux-mm@xxxxxxxxx" <linux-mm@xxxxxxxxx>, "virtualization@xxxxxxxxxxxxxxx" <virtualization@xxxxxxxxxxxxxxx>
- From: Michael Kelley <mhklinux@xxxxxxxxxxx>
- Date: Sat, 15 Mar 2025 04:09:25 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=64mYpXW+f131fQnCaBygXOJ3YNrUCNaVkPytPqvI030=; b=LewznFo4SQK2O2qXcvtznpeehv6IbEO4LAZG6bh/oSMZlAGjV/xAuXEpA93i+rBBE8GjKb0sINNd3DS2FOgxDgwq8HJrqDe1C3/zQOD62yPKMhmezNipK5H4PREWvbnERD1bO+XFVoXe9jSi3ZnBvNT5QGocOc8gSdSagtUKrYqUHyrsTzCoLkFmNEoJiF1588HH0ITCQ72I04kEgpzqR+42sCixy9Yd3i/4S50BOttt5MgXOxgjXzh9gARXJtZuAp7YHNAEpctNveJ7fL//TIjfhulsuG5ABDPL97OlyvgLZjhnSJkfUMdaY81CT41TOOA+c8/kdKUIy5SpDar9KQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uQzpwH+lO9jpic+ItF7Ii44puVZpqFWqXsjSWNtZaUAg6Qb2oF4d4JpQuOrR9d/B+nNFTqYGlQDPNXHMU1+4uWOTqyFCJx4j7jvj7Ew2gW7SOvlnlCiAcvDIk6MvvmhMxzZtmsrM2oIkGLNLpTvrjk/x23pqEYy6hOU3RSzSRI4xPL2F1WPYj0LJIv3uMzHmeZB3RQnSz6493JDyGkvjkmGS8P7V905ICOTq65W47OkXMj9YVOGOnQsYYoosMhfC2U0sLywzyW2qn9J30f0Qr/P2eMzZivSnsx/2WGbPBiorPWoe6Jws5w4hWAl9F1Z+yUborijhAD13TD6Cl34W8A==
- Cc: "alexander.atanasov@xxxxxxxxxxxxx" <alexander.atanasov@xxxxxxxxxxxxx>, "muchun.song@xxxxxxxxx" <muchun.song@xxxxxxxxx>, "roman.gushchin@xxxxxxxxx" <roman.gushchin@xxxxxxxxx>, "mhocko@xxxxxxxxxx" <mhocko@xxxxxxxxxx>, "kys@xxxxxxxxxxxxx" <kys@xxxxxxxxxxxxx>, "haiyangz@xxxxxxxxxxxxx" <haiyangz@xxxxxxxxxxxxx>, "wei.liu@xxxxxxxxxx" <wei.liu@xxxxxxxxxx>, "decui@xxxxxxxxxxxxx" <decui@xxxxxxxxxxxxx>, "jgross@xxxxxxxx" <jgross@xxxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, "oleksandr_tyshchenko@xxxxxxxx" <oleksandr_tyshchenko@xxxxxxxx>, "akpm@xxxxxxxxxxxxxxxxxxxx" <akpm@xxxxxxxxxxxxxxxxxxxx>, "mst@xxxxxxxxxx" <mst@xxxxxxxxxx>, "david@xxxxxxxxxx" <david@xxxxxxxxxx>, "yosry.ahmed@xxxxxxxxx" <yosry.ahmed@xxxxxxxxx>, "hannes@xxxxxxxxxxx" <hannes@xxxxxxxxxxx>, "nphamcs@xxxxxxxxx" <nphamcs@xxxxxxxxx>, "chengming.zhou@xxxxxxxxx" <chengming.zhou@xxxxxxxxx>, "kanchana.p.sridhar@xxxxxxxxx" <kanchana.p.sridhar@xxxxxxxxx>, "llong@xxxxxxxxxx" <llong@xxxxxxxxxx>, "shakeel.butt@xxxxxxxxx" <shakeel.butt@xxxxxxxxx>
- Delivery-date: Sat, 15 Mar 2025 04:10:00 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHblSmRG3n+QHZh2UuvvmIQtVK9S7Nzk1Gg
- Thread-topic: [PATCH v2 3/4] hv_balloon: update the NR_BALLOON_PAGES state
From: Nico Pache <npache@xxxxxxxxxx> 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@xxxxxxxxxx>
> ---
> 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@xxxxxxxxxxx>
|