[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250312025331-mutt-send-email-mst@kernel.org>
Date: Wed, 12 Mar 2025 02:55:45 -0400
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Nico Pache <npache@...hat.com>
Cc: linux-hyperv@...r.kernel.org, linux-kernel@...r.kernel.org,
virtualization@...ts.linux.dev, xen-devel@...ts.xenproject.org,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
cgroups@...r.kernel.org, kys@...rosoft.com, haiyangz@...rosoft.com,
wei.liu@...nel.org, decui@...rosoft.com,
jerrin.shaji-george@...adcom.com,
bcm-kernel-feedback-list@...adcom.com, arnd@...db.de,
gregkh@...uxfoundation.org, david@...hat.com, jasowang@...hat.com,
xuanzhuo@...ux.alibaba.com, eperezma@...hat.com, jgross@...e.com,
sstabellini@...nel.org, oleksandr_tyshchenko@...m.com,
akpm@...ux-foundation.org, hannes@...xchg.org, mhocko@...nel.org,
roman.gushchin@...ux.dev, shakeel.butt@...ux.dev,
muchun.song@...ux.dev, nphamcs@...il.com, yosry.ahmed@...ux.dev,
kanchana.p.sridhar@...el.com, alexander.atanasov@...tuozzo.com
Subject: Re: [RFC 2/5] virtio_balloon: update the NR_BALLOON_PAGES state
On Tue, Mar 11, 2025 at 06:06:57PM -0600, Nico Pache wrote:
> Update the NR_BALLOON_PAGES counter when pages are added to or
> removed from the virtio balloon.
>
> Signed-off-by: Nico Pache <npache@...hat.com>
> ---
> drivers/virtio/virtio_balloon.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 89da052f4f68..406414dbb477 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -274,6 +274,8 @@ static unsigned int fill_balloon(struct virtio_balloon *vb, size_t num)
>
> set_page_pfns(vb, vb->pfns + vb->num_pfns, page);
> vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE;
> + mod_node_page_state(page_pgdat(page), NR_BALLOON_PAGES,
> + VIRTIO_BALLOON_PAGES_PER_PAGE);
> if (!virtio_has_feature(vb->vdev,
> VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
> adjust_managed_page_count(page, -1);
This means the counter is in virtio balloon page units, which
runs counter to the declared goal of making the interface
hypervisor-agnostic.
> @@ -324,6 +326,8 @@ static unsigned int leak_balloon(struct virtio_balloon *vb, size_t num)
> set_page_pfns(vb, vb->pfns + vb->num_pfns, page);
> list_add(&page->lru, &pages);
> vb->num_pages -= VIRTIO_BALLOON_PAGES_PER_PAGE;
> + mod_node_page_state(page_pgdat(page), NR_BALLOON_PAGES,
> + -VIRTIO_BALLOON_PAGES_PER_PAGE);
Same.
Thanks,
> }
>
> num_freed_pages = vb->num_pfns;
> --
> 2.48.1
Powered by blists - more mailing lists