aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/virtio/virtio_balloon.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index c9703d4d6f67..ff71fdcf3345 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -168,8 +168,9 @@ static void release_pages_by_pfn(const u32 pfns[], unsigned int num)
168 } 168 }
169} 169}
170 170
171static void leak_balloon(struct virtio_balloon *vb, size_t num) 171static unsigned leak_balloon(struct virtio_balloon *vb, size_t num)
172{ 172{
173 unsigned num_freed_pages;
173 struct page *page; 174 struct page *page;
174 struct balloon_dev_info *vb_dev_info = &vb->vb_dev_info; 175 struct balloon_dev_info *vb_dev_info = &vb->vb_dev_info;
175 176
@@ -186,6 +187,7 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num)
186 vb->num_pages -= VIRTIO_BALLOON_PAGES_PER_PAGE; 187 vb->num_pages -= VIRTIO_BALLOON_PAGES_PER_PAGE;
187 } 188 }
188 189
190 num_freed_pages = vb->num_pfns;
189 /* 191 /*
190 * Note that if 192 * Note that if
191 * virtio_has_feature(vdev, VIRTIO_BALLOON_F_MUST_TELL_HOST); 193 * virtio_has_feature(vdev, VIRTIO_BALLOON_F_MUST_TELL_HOST);
@@ -195,6 +197,7 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num)
195 tell_host(vb, vb->deflate_vq); 197 tell_host(vb, vb->deflate_vq);
196 mutex_unlock(&vb->balloon_lock); 198 mutex_unlock(&vb->balloon_lock);
197 release_pages_by_pfn(vb->pfns, vb->num_pfns); 199 release_pages_by_pfn(vb->pfns, vb->num_pfns);
200 return num_freed_pages;
198} 201}
199 202
200static inline void update_stat(struct virtio_balloon *vb, int idx, 203static inline void update_stat(struct virtio_balloon *vb, int idx,