From: "Michael S. Tsirkin" <mst@redhat.com>
To: Nico Pache <npache@redhat.com>
Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux.dev, xen-devel@lists.xenproject.org,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
cgroups@vger.kernel.org, kys@microsoft.com,
haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com,
jerrin.shaji-george@broadcom.com,
bcm-kernel-feedback-list@broadcom.com, arnd@arndb.de,
gregkh@linuxfoundation.org, david@redhat.com,
jasowang@redhat.com, xuanzhuo@linux.alibaba.com,
eperezma@redhat.com, jgross@suse.com, sstabellini@kernel.org,
oleksandr_tyshchenko@epam.com, akpm@linux-foundation.org,
hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev,
shakeel.butt@linux.dev, muchun.song@linux.dev, nphamcs@gmail.com,
yosry.ahmed@linux.dev, kanchana.p.sridhar@intel.com,
alexander.atanasov@virtuozzo.com
Subject: Re: [RFC 4/5] vmx_balloon: update the NR_BALLOON_PAGES state
Date: Wed, 12 Mar 2025 16:57:13 -0400 [thread overview]
Message-ID: <20250312165302-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAA1CXcDjEErb2L85gi+W=1sFn73VHLto09nG6f1vS+10o4PctA@mail.gmail.com>
On Wed, Mar 12, 2025 at 02:11:09PM -0600, Nico Pache wrote:
> On Wed, Mar 12, 2025 at 12:57 AM Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Tue, Mar 11, 2025 at 06:06:59PM -0600, Nico Pache wrote:
> > > Update the NR_BALLOON_PAGES counter when pages are added to or
> > > removed from the VMware balloon.
> > >
> > > Signed-off-by: Nico Pache <npache@redhat.com>
> > > ---
> > > drivers/misc/vmw_balloon.c | 5 ++++-
> > > 1 file changed, 4 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
> > > index c817d8c21641..2c70b08c6fb3 100644
> > > --- a/drivers/misc/vmw_balloon.c
> > > +++ b/drivers/misc/vmw_balloon.c
> > > @@ -673,6 +673,8 @@ static int vmballoon_alloc_page_list(struct vmballoon *b,
> > >
> > > vmballoon_stats_page_inc(b, VMW_BALLOON_PAGE_STAT_ALLOC,
> > > ctl->page_size);
> > > + mod_node_page_state(page_pgdat(page), NR_BALLOON_PAGES,
> > > + vmballoon_page_in_frames(ctl->page_size));
> >
> >
> > same issue as virtio I think - this counts frames not pages.
> I agree with the viritio issue since PAGE_SIZE can be larger than
> VIRTIO_BALLOON_PFN_SHIFT, resulting in multiple virtio_balloon pages
> for each page. I fixed that one, thanks!
>
> For the Vmware one, the code is littered with mentions of counting in
> 4k or 2M but as far as I can tell from looking at the code it actually
> operates in PAGE_SIZE or PMD size chunks and this count would be
> correct.
> Perhaps I am missing something though.
Can't say for sure. This needs an ack from the maintainer.
> >
> > > }
> > >
> > > if (page) {
> > > @@ -915,6 +917,8 @@ static void vmballoon_release_page_list(struct list_head *page_list,
> > > list_for_each_entry_safe(page, tmp, page_list, lru) {
> > > list_del(&page->lru);
> > > __free_pages(page, vmballoon_page_order(page_size));
> > > + mod_node_page_state(page_pgdat(page), NR_BALLOON_PAGES,
> > > + -vmballoon_page_in_frames(page_size));
> > > }
> > >
> > > if (n_pages)
> > > @@ -1129,7 +1133,6 @@ static void vmballoon_inflate(struct vmballoon *b)
> > >
> > > /* Update the balloon size */
> > > atomic64_add(ctl.n_pages * page_in_frames, &b->size);
> > > -
> >
> >
> > unrelated change
> Fixed, Thanks for reviewing!
> >
> > > vmballoon_enqueue_page_list(b, &ctl.pages, &ctl.n_pages,
> > > ctl.page_size);
> > >
> > > --
> > > 2.48.1
> >
next prev parent reply other threads:[~2025-03-12 20:57 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-12 0:06 [RFC 0/5] track memory used by balloon drivers Nico Pache
2025-03-12 0:06 ` [RFC 1/5] meminfo: add a per node counter for " Nico Pache
2025-03-12 4:20 ` Shakeel Butt
2025-03-12 20:14 ` Nico Pache
2025-03-12 22:19 ` David Hildenbrand
2025-03-12 23:04 ` Nico Pache
2025-03-13 8:22 ` David Hildenbrand
2025-03-13 17:35 ` Nico Pache
2025-03-13 22:33 ` David Hildenbrand
2025-03-13 7:20 ` Michael S. Tsirkin
2025-03-13 8:17 ` David Hildenbrand
2025-03-12 0:06 ` [RFC 2/5] virtio_balloon: update the NR_BALLOON_PAGES state Nico Pache
2025-03-12 6:55 ` Michael S. Tsirkin
2025-03-12 0:06 ` [RFC 3/5] hv_balloon: " Nico Pache
2025-03-12 0:06 ` [RFC 4/5] vmx_balloon: " Nico Pache
2025-03-12 6:56 ` Michael S. Tsirkin
2025-03-12 20:11 ` Nico Pache
2025-03-12 20:57 ` Michael S. Tsirkin [this message]
2025-03-12 22:17 ` David Hildenbrand
2025-03-12 0:07 ` [RFC 5/5] xen: balloon: " Nico Pache
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=20250312165302-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.atanasov@virtuozzo.com \
--cc=arnd@arndb.de \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=cgroups@vger.kernel.org \
--cc=david@redhat.com \
--cc=decui@microsoft.com \
--cc=eperezma@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=haiyangz@microsoft.com \
--cc=hannes@cmpxchg.org \
--cc=jasowang@redhat.com \
--cc=jerrin.shaji-george@broadcom.com \
--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=mhocko@kernel.org \
--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=xuanzhuo@linux.alibaba.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.