From: Michael Kelley <mhklinux@outlook.com>
To: Nico Pache <npache@redhat.com>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"virtualization@lists.linux.dev" <virtualization@lists.linux.dev>
Cc: "alexander.atanasov@virtuozzo.com"
<alexander.atanasov@virtuozzo.com>,
"muchun.song@linux.dev" <muchun.song@linux.dev>,
"roman.gushchin@linux.dev" <roman.gushchin@linux.dev>,
"mhocko@kernel.org" <mhocko@kernel.org>,
"kys@microsoft.com" <kys@microsoft.com>,
"haiyangz@microsoft.com" <haiyangz@microsoft.com>,
"wei.liu@kernel.org" <wei.liu@kernel.org>,
"decui@microsoft.com" <decui@microsoft.com>,
"jgross@suse.com" <jgross@suse.com>,
"sstabellini@kernel.org" <sstabellini@kernel.org>,
"oleksandr_tyshchenko@epam.com" <oleksandr_tyshchenko@epam.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"mst@redhat.com" <mst@redhat.com>,
"david@redhat.com" <david@redhat.com>,
"yosry.ahmed@linux.dev" <yosry.ahmed@linux.dev>,
"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
"nphamcs@gmail.com" <nphamcs@gmail.com>,
"chengming.zhou@linux.dev" <chengming.zhou@linux.dev>,
"kanchana.p.sridhar@intel.com" <kanchana.p.sridhar@intel.com>,
"llong@redhat.com" <llong@redhat.com>,
"shakeel.butt@linux.dev" <shakeel.butt@linux.dev>
Subject: RE: [PATCH v2 3/4] hv_balloon: update the NR_BALLOON_PAGES state
Date: Sat, 15 Mar 2025 04:09:25 +0000 [thread overview]
Message-ID: <SN6PR02MB4157924B97EF67299E751082D4DD2@SN6PR02MB4157.namprd02.prod.outlook.com> (raw)
In-Reply-To: <20250314213757.244258-4-npache@redhat.com>
From: Nico Pache <npache@redhat.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@redhat.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@outlook.com>
next prev parent reply other threads:[~2025-03-15 4:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 21:37 [PATCH v2 0/4] track memory used by balloon drivers Nico Pache
2025-03-14 21:37 ` [PATCH v2 1/4] meminfo: add a per node counter for " Nico Pache
2025-03-15 1:06 ` Andrew Morton
2025-03-17 22:37 ` Nico Pache
2025-03-14 21:37 ` [PATCH v2 2/4] balloon_compaction: update the NR_BALLOON_PAGES state Nico Pache
2025-03-14 21:37 ` [PATCH v2 3/4] hv_balloon: " Nico Pache
2025-03-15 4:09 ` Michael Kelley [this message]
2025-03-14 21:37 ` [PATCH v2 4/4] xen: balloon: " Nico Pache
2025-03-18 10:16 ` Jürgen Groß
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=SN6PR02MB4157924B97EF67299E751082D4DD2@SN6PR02MB4157.namprd02.prod.outlook.com \
--to=mhklinux@outlook.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.atanasov@virtuozzo.com \
--cc=chengming.zhou@linux.dev \
--cc=david@redhat.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=hannes@cmpxchg.org \
--cc=jgross@suse.com \
--cc=kanchana.p.sridhar@intel.com \
--cc=kys@microsoft.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=llong@redhat.com \
--cc=mhocko@kernel.org \
--cc=mst@redhat.com \
--cc=muchun.song@linux.dev \
--cc=npache@redhat.com \
--cc=nphamcs@gmail.com \
--cc=oleksandr_tyshchenko@epam.com \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=sstabellini@kernel.org \
--cc=virtualization@lists.linux.dev \
--cc=wei.liu@kernel.org \
--cc=xen-devel@lists.xenproject.org \
--cc=yosry.ahmed@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox