diff options
author | Wei Wang <wei.w.wang@intel.com> | 2019-01-07 08:01:05 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2019-03-06 17:19:33 +0100 |
commit | 53e946cb347e8993cee1d091c97a38be73d34bdd (patch) | |
tree | ac1cc6a6413031afedf6d2c789c318fa6e001392 /drivers/virtio | |
parent | virtio-blk: Consider virtio_max_dma_size() for maximum segment size (diff) | |
download | linux-53e946cb347e8993cee1d091c97a38be73d34bdd.tar.xz linux-53e946cb347e8993cee1d091c97a38be73d34bdd.zip |
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.c | 5 |
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); |