linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Wei Wang <wei.w.wang@intel.com>
Cc: Khazhismel Kumykov <khazhy@google.com>,
	jasowang@redhat.com, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 1/2] virtio_balloon: fix pages_to_free calculation
Date: Tue, 19 Nov 2019 04:37:39 -0500	[thread overview]
Message-ID: <20191119043648-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <5DD37FE4.4000407@intel.com>

On Tue, Nov 19, 2019 at 01:38:44PM +0800, Wei Wang wrote:
> On 11/19/2019 07:08 AM, Michael S. Tsirkin wrote:
> > So I really think we should do something like the below instead.
> > Limit playing with balloon pages so we can gradually limit it to legacy.
> > Testing, review would be appreciated.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > 
> > 
> > diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> > index 226fbb995fb0..7cee05cdf3fb 100644
> > --- a/drivers/virtio/virtio_balloon.c
> > +++ b/drivers/virtio/virtio_balloon.c
> > @@ -772,6 +772,13 @@ static unsigned long shrink_free_pages(struct virtio_balloon *vb,
> >   	return blocks_freed << VIRTIO_BALLOON_FREE_PAGE_ORDER;
> >   }
> > +static unsigned long leak_balloon_pages(struct virtio_balloon *vb,
> > +                                          unsigned long pages_to_free)
> > +{
> > +	return leak_balloon(vb, pages_to_free * VIRTIO_BALLOON_PAGES_PER_PAGE) /
> > +		VIRTIO_BALLOON_PAGES_PER_PAGE;
> > +}
> > +
> 
> Looks good to me, too. (just a reminder that the returning type of
> leak_balloon is "unsigned int",

Yea that use of 32 bit integers is another problem with the existing interfaces.

> we may want them to be consistent).
> 
> Reviewed-by: Wei Wang <wei.w.wang@intel.com>
> 
> Best,
> Wei


      reply	other threads:[~2019-11-19  9:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-15 22:55 [PATCH] virtio_balloon: fix shrinker pages_to_free calculation Khazhismel Kumykov
2019-11-18  4:01 ` Wei Wang
2019-11-18  5:30   ` Michael S. Tsirkin
2019-11-18  7:42     ` Wei Wang
2019-11-18  8:26       ` Michael S. Tsirkin
2019-11-18 10:31         ` Wei Wang
2019-11-18  5:26 ` Michael S. Tsirkin
2019-11-18 21:30   ` Khazhismel Kumykov
2019-11-18 21:38     ` [PATCH 1/2] virtio_balloon: fix " Khazhismel Kumykov
2019-11-18 21:38       ` [PATCH 2/2] virtio_balloon: fix shrinker_scan return units Khazhismel Kumykov
2019-11-18 22:56         ` Michael S. Tsirkin
2019-11-18 22:52       ` [PATCH 1/2] virtio_balloon: fix pages_to_free calculation Michael S. Tsirkin
2019-11-18 23:08       ` Michael S. Tsirkin
2019-11-18 23:20         ` Khazhismel Kumykov
2019-11-19  5:38         ` Wei Wang
2019-11-19  9:37           ` Michael S. Tsirkin [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=20191119043648-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=khazhy@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wei.w.wang@intel.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).