[PATCH 1/4 Trusty SRU] virtio_balloon: return the amount of freed memory from leak_balloon()

Kamal Mostafa kamal at canonical.com
Tue Jun 28 19:29:12 UTC 2016


On Mon, Jun 27, 2016 at 06:59:23AM -0500, Christopher Arges wrote:
> Does it make sense to also backport:
> f68b992bbb474641881932c61c92dcfa6f5b3689

Chris, Trusty already carries a backport of that patch (from cc: stable):

    [trusty] 35e5021 virtio_balloon: fix race by fill and leak

> Since that patch will make this a clean cherry-pick and it fixes a ballooning
> bug.  It also looks like it was queued for stable.

(That still doesn't make this patch a clean-cherry pick for other reasons).

 -Kamal


> On Thu, Jun 23, 2016 at 07:38:37AM -0600, Tim Gardner wrote:
> > From: Raushaniya Maksudova <rmaksudova at parallels.com>
> > 
> > BugLink: http://bugs.launchpad.net/bugs/1587089
> > 
> > This value would be useful in the next patch to provide the amount of
> > the freed memory for OOM killer.
> > 
> > Signed-off-by: Raushaniya Maksudova <rmaksudova at parallels.com>
> > Signed-off-by: Denis V. Lunev <den at openvz.org>
> > CC: Rusty Russell <rusty at rustcorp.com.au>
> > CC: Michael S. Tsirkin <mst at redhat.com>
> > Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
> > (back ported from commit 1fd9c67203af91977bf3b964ff3744cf74fc6f3f)
> > Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
> > 
> > Conflicts:
> > 	drivers/virtio/virtio_balloon.c
> > ---
> >  drivers/virtio/virtio_balloon.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> > index a4531fc..54a9c033 100644
> > --- a/drivers/virtio/virtio_balloon.c
> > +++ b/drivers/virtio/virtio_balloon.c
> > @@ -169,8 +169,9 @@ static void release_pages_by_pfn(const u32 pfns[], unsigned int num)
> >  	}
> >  }
> >  
> > -static void leak_balloon(struct virtio_balloon *vb, size_t num)
> > +static unsigned leak_balloon(struct virtio_balloon *vb, size_t num)
> >  {
> > +	unsigned num_freed_pages;
> >  	struct page *page;
> >  	struct balloon_dev_info *vb_dev_info = vb->vb_dev_info;
> >  
> > @@ -187,6 +188,7 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num)
> >  		vb->num_pages -= VIRTIO_BALLOON_PAGES_PER_PAGE;
> >  	}
> >  
> > +	num_freed_pages = vb->num_pfns;
> >  	/*
> >  	 * Note that if
> >  	 * virtio_has_feature(vdev, VIRTIO_BALLOON_F_MUST_TELL_HOST);
> > @@ -196,6 +198,7 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num)
> >  		tell_host(vb, vb->deflate_vq);
> >  	release_pages_by_pfn(vb->pfns, vb->num_pfns);
> >  	mutex_unlock(&vb->balloon_lock);
> > +	return num_freed_pages;
> >  }
> >  
> >  static inline void update_stat(struct virtio_balloon *vb, int idx,
> > -- 
> > 1.9.1
> > 
> > 
> > -- 
> > kernel-team mailing list
> > kernel-team at lists.ubuntu.com
> > https://lists.ubuntu.com/mailman/listinfo/kernel-team
> 
> -- 
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team




More information about the kernel-team mailing list