From: "Michael S. Tsirkin" <mst@redhat.com>
To: Sasha Levin <levinsasha928@gmail.com>
Cc: linux-kernel@vger.kernel.org,
Rusty Russell <rusty@rustcorp.com.au>,
virtualization@lists.linux-foundation.org, kvm@vger.kernel.org,
dave@linux.vnet.ibm.com, Amit Shah <amit.shah@redhat.com>
Subject: Re: [PATCH] virtio_balloon: Notify guest only after deflating the balloon
Date: Sun, 3 Jul 2011 11:27:48 +0300 [thread overview]
Message-ID: <20110703082748.GD13183@redhat.com> (raw)
In-Reply-To: <1309576016-22800-1-git-send-email-levinsasha928@gmail.com>
Doesn't this basically just revert
bf50e69f63d21091e525185c3ae761412be0ba72?
On Sat, Jul 02, 2011 at 06:06:56AM +0300, Sasha Levin wrote:
> Unless the host requires that requested pages won't be used until
> he us notified (VIRTIO_BALLOON_F_MUST_TELL_HOST), only notify after
> deflating the balloon.
>
> This will avoid having to take an exit before actually using the pages.
>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: virtualization@lists.linux-foundation.org
> Cc: kvm@vger.kernel.org
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
> drivers/virtio/virtio_balloon.c | 16 ++++++++++------
> 1 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index e058ace..055f95d 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -148,14 +148,18 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num)
> vb->num_pages--;
> }
>
> -
> /*
> - * Note that if
> - * virtio_has_feature(vdev, VIRTIO_BALLOON_F_MUST_TELL_HOST);
> - * is true, we *have* to do it in this order
> + * If the host doesn't require us to notify him before using
> + * pages which belong to the balloon, update him only after
> + * freeing those pages for guest use.
> */
> - tell_host(vb, vb->deflate_vq);
> - release_pages_by_pfn(vb->pfns, vb->num_pfns);
> + if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_MUST_TELL_HOST)) {
> + tell_host(vb, vb->deflate_vq);
> + release_pages_by_pfn(vb->pfns, vb->num_pfns);
> + } else {
> + release_pages_by_pfn(vb->pfns, vb->num_pfns);
> + tell_host(vb, vb->deflate_vq);
> + }
> }
>
> static inline void update_stat(struct virtio_balloon *vb, int idx,
> --
> 1.7.6
next prev parent reply other threads:[~2011-07-03 8:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-02 3:06 [PATCH] virtio_balloon: Notify guest only after deflating the balloon Sasha Levin
2011-07-03 8:27 ` Michael S. Tsirkin [this message]
2011-07-03 9:46 ` Sasha Levin
2011-07-03 10:30 ` Michael S. Tsirkin
2011-07-03 10:52 ` Sasha Levin
2011-07-03 12:11 ` Michael S. Tsirkin
2011-07-03 12:32 ` Sasha Levin
2011-07-03 13:44 ` Michael S. Tsirkin
2011-07-03 15:12 ` Sasha Levin
2011-07-03 16:36 ` Michael S. Tsirkin
2011-07-04 7:37 ` Rusty Russell
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=20110703082748.GD13183@redhat.com \
--to=mst@redhat.com \
--cc=amit.shah@redhat.com \
--cc=dave@linux.vnet.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=levinsasha928@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.linux-foundation.org \
/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