]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
virtio: balloon: leak / fill balloon across S4
authorAmit Shah <amit.shah@redhat.com>
Wed, 29 Feb 2012 12:12:51 +0000 (17:42 +0530)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 29 Feb 2012 22:58:41 +0000 (09:28 +1030)
commit4eb05d562ea1ea34ff607aa877aefbf05b21c140
treeac0d2afc54f208fce7c91a4f0c3704d95e5d9561
parent5ffca28a4ac7abb8a254fafe6bd03b2f83667df7
virtio: balloon: leak / fill balloon across S4

commit e562966dbaf49e7804097cd991e5d3a8934fc148 added support for S4 to
the balloon driver.  The freeze function did nothing to free the pages,
since reclaiming the pages from the host to immediately give them back
(if S4 was successful) seemed wasteful.  Also, if S4 wasn't successful,
the guest would have to re-fill the balloon.  On restore, the pages were
supposed to be marked freed and the free page counters were incremented
to reflect the balloon was totally deflated.

However, this wasn't done right.  The pages that were earlier taken away
from the guest during a balloon inflation operation were just shown as
used pages after a successful restore from S4.  Just a fancy way of
leaking lots of memory.

Instead of trying that, just leak the balloon on freeze and fill it on
restore/thaw paths.  This works properly now.  The optimisation to not
leak can be added later on after a bit of refactoring of the code.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/virtio/virtio_balloon.c