From: Wei Liu <wei.liu@kernel.org>
To: Shradha Gupta <shradhagupta@linux.microsoft.com>
Cc: linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org,
"K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
Long Li <longli@microsoft.com>,
Michael Kelley <mikelley@microsoft.com>
Subject: Re: [PATCH] hv_balloon: Fix committed value in post_status() if dynamic memory is disabled
Date: Fri, 11 Nov 2022 16:50:40 +0000 [thread overview]
Message-ID: <Y259YF07nSes6zlp@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <1667544770-31377-1-git-send-email-shradhagupta@linux.microsoft.com>
On Thu, Nov 03, 2022 at 11:52:50PM -0700, Shradha Gupta wrote:
> If Dynamic memory is disabled for VM, the committed value reported by the
> post_status() call by hv_balloon driver includes compute_balloon_floor().
> This is not needed if balloon_up operations or hot_add operations were
> never requested on the VM(or if Dynamic memory was disabled for the VM)
>
> Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
Can you put a Fixes: tag here?
You can use git-blame to find out the culprit.
Thanks,
Wei.
> ---
> drivers/hv/hv_balloon.c | 22 +++++++++++++++++-----
> 1 file changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
> index fdf6decacf06..a6f5321d4a2e 100644
> --- a/drivers/hv/hv_balloon.c
> +++ b/drivers/hv/hv_balloon.c
> @@ -1129,11 +1129,23 @@ static unsigned long compute_balloon_floor(void)
>
> static unsigned long get_pages_committed(struct hv_dynmem_device *dm)
> {
> - return vm_memory_committed() +
> - dm->num_pages_ballooned +
> - (dm->num_pages_added > dm->num_pages_onlined ?
> - dm->num_pages_added - dm->num_pages_onlined : 0) +
> - compute_balloon_floor();
> + unsigned long pages_committed;
> +
> + pages_committed = vm_memory_committed();
> +
> + /*
> + * If no balloon_up or hot_add operation was performed do not add
> + * num_pages_ballooned, number of pages offline or
> + * compute_balloon_floor() to the pages_committed value
> + */
> + if (dm->num_pages_ballooned || dm->num_pages_added) {
> + pages_committed += dm->num_pages_ballooned +
> + (dm->num_pages_added > dm->num_pages_onlined ?
> + dm->num_pages_added - dm->num_pages_onlined : 0) +
> + compute_balloon_floor();
> + }
> +
> + return pages_committed;
> }
>
> /*
> --
> 2.37.2
>
prev parent reply other threads:[~2022-11-11 16:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-04 6:52 [PATCH] hv_balloon: Fix committed value in post_status() if dynamic memory is disabled Shradha Gupta
2022-11-11 16:50 ` Wei Liu [this message]
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=Y259YF07nSes6zlp@liuwe-devbox-debian-v2 \
--to=wei.liu@kernel.org \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=mikelley@microsoft.com \
--cc=shradhagupta@linux.microsoft.com \
--cc=sthemmin@microsoft.com \
/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;
as well as URLs for NNTP newsgroup(s).