[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 22/23] migration: Use multifd before we check for the zero
|
From: |
Dr. David Alan Gilbert |
|
Subject: |
Re: [PATCH v4 22/23] migration: Use multifd before we check for the zero page |
|
Date: |
Tue, 18 Jan 2022 20:01:41 +0000 |
|
User-agent: |
Mutt/2.1.5 (2021-12-30) |
* Juan Quintela (quintela@redhat.com) wrote:
> So we use multifd to transmit zero pages.
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
> migration/ram.c | 32 +++++++++++++++++++++++++++++++-
> 1 file changed, 31 insertions(+), 1 deletion(-)
>
> diff --git a/migration/ram.c b/migration/ram.c
> index 3536778e19..bdc7cec4cd 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -2168,6 +2168,32 @@ static int ram_save_target_page_legacy(RAMState *rs,
> PageSearchStatus *pss)
> return ram_save_page(rs, pss);
> }
>
> +/**
> + * ram_save_target_page_multifd: save one target page
> + *
> + * Returns the number of pages written
> + *
> + * @rs: current RAM state
> + * @pss: data about the page we want to send
> + */
> +static int ram_save_target_page_multifd(RAMState *rs, PageSearchStatus *pss)
> +{
> + RAMBlock *block = pss->block;
> + ram_addr_t offset = ((ram_addr_t)pss->page) << TARGET_PAGE_BITS;
> + int res;
> +
> + if (!migration_in_postcopy()) {
> + return ram_save_multifd_page(rs, block, offset);
> + }
> +
> + res = save_zero_page(rs, block, offset);
I'm confused; I think I was expecting to see in this patch, the one that
would check the parameter you added and do something different - where
did that go?
Note I think this is quite subtle that the difference here is really
just the ordering rather than adding a zero page test.
Dave
> + if (res > 0) {
> + return res;
> + }
> +
> + return ram_save_page(rs, pss);
> +}
> +
> /**
> * ram_save_host_page: save a whole host page
> *
> @@ -3011,7 +3037,11 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
> ram_control_before_iterate(f, RAM_CONTROL_SETUP);
> ram_control_after_iterate(f, RAM_CONTROL_SETUP);
>
> - (*rsp)->ram_save_target_page = ram_save_target_page_legacy;
> + if (migrate_use_multifd()) {
> + (*rsp)->ram_save_target_page = ram_save_target_page_multifd;
> + } else {
> + (*rsp)->ram_save_target_page = ram_save_target_page_legacy;
> + }
> multifd_send_sync_main(f);
> qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
> qemu_fflush(f);
> --
> 2.34.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
- [PATCH v4 08/23] multifd: Move iov from pages to params, (continued)
- [PATCH v4 08/23] multifd: Move iov from pages to params, Juan Quintela, 2022/01/11
- [PATCH v4 06/23] migration: Move ram_release_pages() call to save_zero_page_to_file(), Juan Quintela, 2022/01/11
- [PATCH v4 11/23] multifd: Remove send_write() method, Juan Quintela, 2022/01/11
- [PATCH v4 12/23] multifd: Use a single writev on the send side, Juan Quintela, 2022/01/11
- [PATCH v4 19/23] multifd: Add property to enable/disable zero_page, Juan Quintela, 2022/01/11
- [PATCH v4 22/23] migration: Use multifd before we check for the zero page, Juan Quintela, 2022/01/11
- Re: [PATCH v4 22/23] migration: Use multifd before we check for the zero page,
Dr. David Alan Gilbert <=
- [PATCH v4 16/23] multifd: recv side only needs the RAMBlock host address, Juan Quintela, 2022/01/11
- [PATCH v4 14/23] multifd: Use normal pages array on the send side, Juan Quintela, 2022/01/11
- [PATCH v4 15/23] multifd: Use normal pages array on the recv side, Juan Quintela, 2022/01/11
- [PATCH v4 18/23] migration: Make ram_save_target_page() a pointer, Juan Quintela, 2022/01/11
- [PATCH v4 17/23] multifd: Rename pages_used to normal_pages, Juan Quintela, 2022/01/11
- [PATCH v4 13/23] multifd: Unfold "used" variable by its value, Juan Quintela, 2022/01/11