···367367#ifdef CONFIG_PM368368static int virtballoon_freeze(struct virtio_device *vdev)369369{370370+ struct virtio_balloon *vb = vdev->priv;371371+370372 /*371373 * The kthread is already frozen by the PM core before this372374 * function is called.373375 */376376+377377+ while (vb->num_pages)378378+ leak_balloon(vb, vb->num_pages);379379+ update_balloon_size(vb);374380375381 /* Ensure we don't get any more requests from the host */376382 vdev->config->reset(vdev);···384378 return 0;385379}386380381381+static int restore_common(struct virtio_device *vdev)382382+{383383+ struct virtio_balloon *vb = vdev->priv;384384+ int ret;385385+386386+ ret = init_vqs(vdev->priv);387387+ if (ret)388388+ return ret;389389+390390+ fill_balloon(vb, towards_target(vb));391391+ update_balloon_size(vb);392392+ return 0;393393+}394394+387395static int virtballoon_thaw(struct virtio_device *vdev)388396{389389- return init_vqs(vdev->priv);397397+ return restore_common(vdev);390398}391399392400static int virtballoon_restore(struct virtio_device *vdev)393401{394402 struct virtio_balloon *vb = vdev->priv;395395- struct page *page, *page2;396396-397397- /* We're starting from a clean slate */398398- vb->num_pages = 0;399403400404 /*401405 * If a request wasn't complete at the time of freezing, this···413397 */414398 vb->need_stats_update = 0;415399416416- /* We don't have these pages in the balloon anymore! */417417- list_for_each_entry_safe(page, page2, &vb->pages, lru) {418418- list_del(&page->lru);419419- totalram_pages++;420420- }421421- return init_vqs(vdev->priv);400400+ return restore_common(vdev);422401}423402#endif424403