diff mbox series

[v2,2/3] migration/ram: Modify ram_save_host_page() to match the comment

Message ID 20210301082132.1107-3-jiangkunkun@huawei.com
State New
Headers show
Series Some modifications about ram_save_host_page() | expand

Commit Message

Kunkun Jiang March 1, 2021, 8:21 a.m. UTC
According to the comment, when the host page is a huge page, the
migration_rate_limit() should be executed. If not, this function
can be omitted to save time.

Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>
---
 migration/ram.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

David Edmondson March 3, 2021, 8:37 a.m. UTC | #1
On Monday, 2021-03-01 at 16:21:31 +08, Kunkun Jiang wrote:

> According to the comment, when the host page is a huge page, the
> migration_rate_limit() should be executed. If not, this function
> can be omitted to save time.
>
> Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
> Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>

Reviewed-by: David Edmondson <david.edmondson@oracle.com>

> ---
>  migration/ram.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/migration/ram.c b/migration/ram.c
> index 24967cb970..3a9115b6dc 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -2014,7 +2014,9 @@ static int ram_save_host_page(RAMState *rs, PageSearchStatus *pss,
>          pages += tmppages;
>          pss->page++;
>          /* Allow rate limiting to happen in the middle of huge pages */
> -        migration_rate_limit();
> +        if (pagesize_bits > 1) {
> +            migration_rate_limit();
> +        }
>      } while ((pss->page & (pagesize_bits - 1)) &&
>               offset_in_ramblock(pss->block,
>                                  ((ram_addr_t)pss->page) << TARGET_PAGE_BITS));
> -- 
> 2.23.0

dme.
diff mbox series

Patch

diff --git a/migration/ram.c b/migration/ram.c
index 24967cb970..3a9115b6dc 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2014,7 +2014,9 @@  static int ram_save_host_page(RAMState *rs, PageSearchStatus *pss,
         pages += tmppages;
         pss->page++;
         /* Allow rate limiting to happen in the middle of huge pages */
-        migration_rate_limit();
+        if (pagesize_bits > 1) {
+            migration_rate_limit();
+        }
     } while ((pss->page & (pagesize_bits - 1)) &&
              offset_in_ramblock(pss->block,
                                 ((ram_addr_t)pss->page) << TARGET_PAGE_BITS));