diff mbox series

[3/3] migration/postcopy: discard_length must not be 0

Message ID 20190627020822.15485-4-richardw.yang@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series migration/postcopy: cleanup function postcopy_send_discard_bm_ram | expand

Commit Message

Wei Yang June 27, 2019, 2:08 a.m. UTC
Since we break the loop when there is no more page to discard, we are
sure the following process would find some page to discard.

It is not necessary to check it again.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
 migration/ram.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Dr. David Alan Gilbert June 28, 2019, 3:17 p.m. UTC | #1
* Wei Yang (richardw.yang@linux.intel.com) wrote:
> Since we break the loop when there is no more page to discard, we are
> sure the following process would find some page to discard.
> 
> It is not necessary to check it again.
> 
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>

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

> ---
>  migration/ram.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/migration/ram.c b/migration/ram.c
> index b41b58ee54..246efe6939 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -2789,9 +2789,7 @@ static int postcopy_send_discard_bm_ram(MigrationState *ms,
>          } else {
>              discard_length = zero - one;
>          }
> -        if (discard_length) {
> -            postcopy_discard_send_range(ms, pds, one, discard_length);
> -        }
> +        postcopy_discard_send_range(ms, pds, one, discard_length);
>          current = one + discard_length;
>      }
>  
> -- 
> 2.19.1
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff mbox series

Patch

diff --git a/migration/ram.c b/migration/ram.c
index b41b58ee54..246efe6939 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2789,9 +2789,7 @@  static int postcopy_send_discard_bm_ram(MigrationState *ms,
         } else {
             discard_length = zero - one;
         }
-        if (discard_length) {
-            postcopy_discard_send_range(ms, pds, one, discard_length);
-        }
+        postcopy_discard_send_range(ms, pds, one, discard_length);
         current = one + discard_length;
     }