Skip to content

Commit 53e946c

Browse files
wei-w-wangmstsirkin
authored andcommitted
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>
1 parent fd1068e commit 53e946c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/virtio/virtio_balloon.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,12 @@ static void update_balloon_size_func(struct work_struct *work)
457457
update_balloon_size_work);
458458
diff = towards_target(vb);
459459

460+
if (!diff)
461+
return;
462+
460463
if (diff > 0)
461464
diff -= fill_balloon(vb, diff);
462-
else if (diff < 0)
465+
else
463466
diff += leak_balloon(vb, -diff);
464467
update_balloon_size(vb);
465468

0 commit comments

Comments
 (0)