diff mbox series

[v1,1/2] virtio-balloon: Enable free page hinting during PRECOPY_NOTIFY_SETUP

Message ID c799b1f96e55c5eb9c07e5a70a51b8ba67e7bcc9.1731128180.git.yong.huang@smartx.com (mailing list archive)
State New
Headers show
Series migration: Skip the first dirty sync | expand

Commit Message

Yong Huang Nov. 9, 2024, 4:59 a.m. UTC
PRECOPY_NOTIFY_AFTER_BITMAP_SYNC was interpreted by free page hinting
optimization as an indication to begin freeing pages. But there's no
assurance that a sync is required when beginning a migration. Therefore,
during PRECOPY_NOTIFY_SETUP, as well as PRECOPY_NOTIFY_AFTER_BITMAP_SYNC,
enable free page hinting.

Signed-off-by: Hyman Huang <yong.huang@smartx.com>
---
 hw/virtio/virtio-balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Hildenbrand Nov. 12, 2024, 10:10 a.m. UTC | #1
On 09.11.24 05:59, Hyman Huang wrote:
> PRECOPY_NOTIFY_AFTER_BITMAP_SYNC was interpreted by free page hinting
> optimization as an indication to begin freeing pages. But there's no
> assurance that a sync is required when beginning a migration. Therefore,
> during PRECOPY_NOTIFY_SETUP, as well as PRECOPY_NOTIFY_AFTER_BITMAP_SYNC,
> enable free page hinting.

But what does this change bring us in practice? How was it tested that 
this makes any difference?
diff mbox series

Patch

diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 609e39a821..2f1e086cd8 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -663,6 +663,7 @@  virtio_balloon_free_page_hint_notify(NotifierWithReturn *n, void *data,
     case PRECOPY_NOTIFY_BEFORE_BITMAP_SYNC:
         virtio_balloon_free_page_stop(dev);
         break;
+    case PRECOPY_NOTIFY_SETUP:
     case PRECOPY_NOTIFY_AFTER_BITMAP_SYNC:
         if (vdev->vm_running) {
             virtio_balloon_free_page_start(dev);
@@ -679,7 +680,6 @@  virtio_balloon_free_page_hint_notify(NotifierWithReturn *n, void *data,
          */
         virtio_balloon_free_page_done(dev);
         break;
-    case PRECOPY_NOTIFY_SETUP:
     case PRECOPY_NOTIFY_COMPLETE:
         break;
     default: