diff mbox series

[RFC,11/15] migration: Add pss.postcopy_requested status

Message ID 20220119080929.39485-12-peterx@redhat.com (mailing list archive)
State New, archived
Headers show
Series migration: Postcopy Preemption | expand

Commit Message

Peter Xu Jan. 19, 2022, 8:09 a.m. UTC
This boolean flag shows whether the current page during migration is triggered
by postcopy or not.  Then in ram_save_host_page() and deeper stack we'll be
able to have a reference on the priority of this page.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 migration/ram.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Dr. David Alan Gilbert Feb. 3, 2022, 3:42 p.m. UTC | #1
* Peter Xu (peterx@redhat.com) wrote:
> This boolean flag shows whether the current page during migration is triggered
> by postcopy or not.  Then in ram_save_host_page() and deeper stack we'll be
> able to have a reference on the priority of this page.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  migration/ram.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/migration/ram.c b/migration/ram.c
> index 3a7d943f9c..b7d17613e8 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -400,6 +400,8 @@ struct PageSearchStatus {
>      unsigned long page;
>      /* Set once we wrap around */
>      bool         complete_round;
> +    /* Whether current page is explicitly requested by postcopy */
> +    bool         postcopy_requested;
>  };
>  typedef struct PageSearchStatus PageSearchStatus;
>  
> @@ -1480,6 +1482,9 @@ retry:
>   */
>  static bool find_dirty_block(RAMState *rs, PageSearchStatus *pss, bool *again)
>  {
> +    /* This is not a postcopy requested page */
> +    pss->postcopy_requested = false;
> +
>      pss->page = migration_bitmap_find_dirty(rs, pss->block, pss->page);
>      if (pss->complete_round && pss->block == rs->last_seen_block &&
>          pss->page >= rs->last_page) {
> @@ -1971,6 +1976,7 @@ static bool get_queued_page(RAMState *rs, PageSearchStatus *pss)
>           * really rare.
>           */
>          pss->complete_round = false;
> +        pss->postcopy_requested = true;
>      }
>  
>      return !!block;
> -- 
> 2.32.0
>
diff mbox series

Patch

diff --git a/migration/ram.c b/migration/ram.c
index 3a7d943f9c..b7d17613e8 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -400,6 +400,8 @@  struct PageSearchStatus {
     unsigned long page;
     /* Set once we wrap around */
     bool         complete_round;
+    /* Whether current page is explicitly requested by postcopy */
+    bool         postcopy_requested;
 };
 typedef struct PageSearchStatus PageSearchStatus;
 
@@ -1480,6 +1482,9 @@  retry:
  */
 static bool find_dirty_block(RAMState *rs, PageSearchStatus *pss, bool *again)
 {
+    /* This is not a postcopy requested page */
+    pss->postcopy_requested = false;
+
     pss->page = migration_bitmap_find_dirty(rs, pss->block, pss->page);
     if (pss->complete_round && pss->block == rs->last_seen_block &&
         pss->page >= rs->last_page) {
@@ -1971,6 +1976,7 @@  static bool get_queued_page(RAMState *rs, PageSearchStatus *pss)
          * really rare.
          */
         pss->complete_round = false;
+        pss->postcopy_requested = true;
     }
 
     return !!block;