summaryrefslogtreecommitdiffstats
path: root/drivers/virtio
diff options
context:
space:
mode:
authorWei Wang <wei.w.wang@intel.com>2019-01-07 15:01:05 +0800
committerMichael S. Tsirkin <mst@redhat.com>2019-03-06 11:19:33 -0500
commit53e946cb347e8993cee1d091c97a38be73d34bdd (patch)
treeac1cc6a6413031afedf6d2c789c318fa6e001392 /drivers/virtio
parentfd1068e1860e44aaaa337b516df4518d1ce98da1 (diff)
downloadlinux-53e946cb347e8993cee1d091c97a38be73d34bdd.tar.bz2
virtio-balloon: improve update_balloon_size_func
There is no need to update the balloon actual register when there is no ballooning request. This patch avoids update_balloon_size when diff is 0. Signed-off-by: Wei Wang <wei.w.wang@intel.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Halil Pasic <pasic@linux.ibm.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/virtio')
-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 fb12fe205f86..e33dc8e9e87d 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -457,9 +457,12 @@ static void update_balloon_size_func(struct work_struct *work)
update_balloon_size_work);
diff = towards_target(vb);
+ if (!diff)
+ return;
+
if (diff > 0)
diff -= fill_balloon(vb, diff);
- else if (diff < 0)
+ else
diff += leak_balloon(vb, -diff);
update_balloon_size(vb);