[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <26e942e3-4e06-4644-b19b-ae0301bf9b2a@redhat.com>
Date: Wed, 12 Mar 2025 23:17:18 +0100
From: David Hildenbrand <david@...hat.com>
To: Nico Pache <npache@...hat.com>, "Michael S. Tsirkin" <mst@...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, 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 4/5] vmx_balloon: update the NR_BALLOON_PAGES state
On 12.03.25 21:11, Nico Pache wrote:
> On Wed, Mar 12, 2025 at 12:57 AM Michael S. Tsirkin <mst@...hat.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@...hat.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.
vmballoon_page_in_frames() documents to "Return: the number of 4k
frames.", because it supports either 4k or 2M chunks IIRC.
I think the catch is that PAGE_SIZE will in these configs always be 4k.
Otherwise things like vmballoon_mark_page_offline() wouldn't work as
expected.
So I think this is correct.
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists