From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org,
Leonardo Bras Soares Passos <lsoaresp@redhat.com>,
James Houghton <jthoughton@google.com>,
Juan Quintela <quintela@redhat.com>
Subject: Re: [PATCH RFC 13/21] migration: Add migration_ram_pagesize_largest()
Date: Tue, 24 Jan 2023 17:34:46 +0000 [thread overview]
Message-ID: <Y9AWtl9UUzc8y9QY@work-vm> (raw)
In-Reply-To: <20230117220914.2062125-14-peterx@redhat.com>
* Peter Xu (peterx@redhat.com) wrote:
> Let it replace the old qemu_ram_pagesize_largest() just to fetch the page
> sizes using migration_ram_pagesize(), because it'll start to consider
> double mapping effect in migrations.
>
> Also don't account the ignored ramblocks as they won't be migrated.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> include/exec/cpu-common.h | 1 -
> migration/migration.c | 2 +-
> migration/ram.c | 12 ++++++++++++
> migration/ram.h | 1 +
> softmmu/physmem.c | 13 -------------
> 5 files changed, 14 insertions(+), 15 deletions(-)
>
> diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
> index 94452aa17f..4c394ccdfc 100644
> --- a/include/exec/cpu-common.h
> +++ b/include/exec/cpu-common.h
> @@ -96,7 +96,6 @@ int qemu_ram_get_fd(RAMBlock *rb);
>
> size_t qemu_ram_pagesize(RAMBlock *block);
> bool qemu_ram_is_hugetlb(RAMBlock *rb);
> -size_t qemu_ram_pagesize_largest(void);
>
> /**
> * cpu_address_space_init:
> diff --git a/migration/migration.c b/migration/migration.c
> index f6fe474fc3..7724e00c47 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -604,7 +604,7 @@ process_incoming_migration_co(void *opaque)
>
> assert(mis->from_src_file);
> mis->migration_incoming_co = qemu_coroutine_self();
> - mis->largest_page_size = qemu_ram_pagesize_largest();
> + mis->largest_page_size = migration_ram_pagesize_largest();
> postcopy_state_set(POSTCOPY_INCOMING_NONE);
> migrate_set_state(&mis->state, MIGRATION_STATUS_NONE,
> MIGRATION_STATUS_ACTIVE);
> diff --git a/migration/ram.c b/migration/ram.c
> index 945c6477fd..2ebf414f5f 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -135,6 +135,18 @@ size_t migration_ram_pagesize(RAMBlock *block)
> return qemu_ram_pagesize(block);
> }
>
> +size_t migration_ram_pagesize_largest(void)
> +{
> + RAMBlock *block;
> + size_t largest = 0;
> +
> + RAMBLOCK_FOREACH_NOT_IGNORED(block) {
> + largest = MAX(largest, migration_ram_pagesize(block));
> + }
> +
> + return largest;
> +}
> +
> static void XBZRLE_cache_lock(void)
> {
> if (migrate_use_xbzrle()) {
> diff --git a/migration/ram.h b/migration/ram.h
> index 162b3e7cb8..cefe166841 100644
> --- a/migration/ram.h
> +++ b/migration/ram.h
> @@ -69,6 +69,7 @@ bool ramblock_is_ignored(RAMBlock *block);
>
> int xbzrle_cache_resize(uint64_t new_size, Error **errp);
> size_t migration_ram_pagesize(RAMBlock *block);
> +size_t migration_ram_pagesize_largest(void);
> uint64_t ram_bytes_remaining(void);
> uint64_t ram_bytes_total(void);
> void mig_throttle_counter_reset(void);
> diff --git a/softmmu/physmem.c b/softmmu/physmem.c
> index cdda7eaea5..536c204811 100644
> --- a/softmmu/physmem.c
> +++ b/softmmu/physmem.c
> @@ -1813,19 +1813,6 @@ bool qemu_ram_is_hugetlb(RAMBlock *rb)
> return rb->page_size > qemu_real_host_page_size();
> }
>
> -/* Returns the largest size of page in use */
> -size_t qemu_ram_pagesize_largest(void)
> -{
> - RAMBlock *block;
> - size_t largest = 0;
> -
> - RAMBLOCK_FOREACH(block) {
> - largest = MAX(largest, qemu_ram_pagesize(block));
> - }
> -
> - return largest;
> -}
> -
> static int memory_try_enable_merging(void *addr, size_t len)
> {
> if (!machine_mem_merge(current_machine)) {
> --
> 2.37.3
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2023-01-24 17:35 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 22:08 [PATCH RFC 00/21] migration: Support hugetlb doublemaps Peter Xu
2023-01-17 22:08 ` [PATCH RFC 01/21] update linux headers Peter Xu
2023-01-17 22:08 ` [PATCH RFC 02/21] util: Include osdep.h first in util/mmap-alloc.c Peter Xu
2023-01-18 12:00 ` Dr. David Alan Gilbert
2023-01-25 0:19 ` Philippe Mathieu-Daudé
2023-01-30 4:57 ` Juan Quintela
2023-01-17 22:08 ` [PATCH RFC 03/21] physmem: Add qemu_ram_is_hugetlb() Peter Xu
2023-01-18 12:02 ` Dr. David Alan Gilbert
2023-01-30 5:00 ` Juan Quintela
2023-01-17 22:08 ` [PATCH RFC 04/21] madvise: Include linux/mman.h under linux-headers/ Peter Xu
2023-01-18 12:08 ` Dr. David Alan Gilbert
2023-01-30 5:01 ` Juan Quintela
2023-01-17 22:08 ` [PATCH RFC 05/21] madvise: Add QEMU_MADV_SPLIT Peter Xu
2023-01-30 5:01 ` Juan Quintela
2023-01-17 22:08 ` [PATCH RFC 06/21] madvise: Add QEMU_MADV_COLLAPSE Peter Xu
2023-01-18 18:51 ` Dr. David Alan Gilbert
2023-01-18 20:21 ` Peter Xu
2023-01-30 5:02 ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 07/21] ramblock: Cache file offset for file-backed ramblocks Peter Xu
2023-01-30 5:02 ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 08/21] ramblock: Cache the length to do file mmap() on ramblocks Peter Xu
2023-01-23 18:51 ` Dr. David Alan Gilbert
2023-01-24 20:28 ` Peter Xu
2023-01-30 5:05 ` Juan Quintela
2023-01-30 22:07 ` Peter Xu
2023-01-17 22:09 ` [PATCH RFC 09/21] ramblock: Add RAM_READONLY Peter Xu
2023-01-23 19:42 ` Dr. David Alan Gilbert
2023-01-30 5:06 ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 10/21] ramblock: Add ramblock_file_map() Peter Xu
2023-01-24 10:06 ` Dr. David Alan Gilbert
2023-01-24 20:47 ` Peter Xu
2023-01-25 9:24 ` Dr. David Alan Gilbert
2023-01-25 14:46 ` Peter Xu
2023-01-30 5:09 ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 11/21] migration: Add hugetlb-doublemap cap Peter Xu
2023-01-24 12:45 ` Dr. David Alan Gilbert
2023-01-24 21:15 ` Peter Xu
2023-01-30 5:13 ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 12/21] migration: Introduce page size for-migration-only Peter Xu
2023-01-24 13:20 ` Dr. David Alan Gilbert
2023-01-24 21:36 ` Peter Xu
2023-01-24 22:03 ` Peter Xu
2023-01-30 5:17 ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 13/21] migration: Add migration_ram_pagesize_largest() Peter Xu
2023-01-24 17:34 ` Dr. David Alan Gilbert [this message]
2023-01-30 5:19 ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 14/21] migration: Map hugetlbfs ramblocks twice, and pre-allocate Peter Xu
2023-01-25 14:25 ` Dr. David Alan Gilbert
2023-01-30 5:24 ` Juan Quintela
2023-01-30 22:35 ` Peter Xu
2023-02-01 18:53 ` Juan Quintela
2023-02-06 21:40 ` Peter Xu
2023-01-17 22:09 ` [PATCH RFC 15/21] migration: Teach qemu about minor faults and doublemap Peter Xu
2023-01-30 5:45 ` Juan Quintela
2023-01-30 22:50 ` Peter Xu
2023-02-01 18:55 ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 16/21] migration: Enable doublemap with MADV_SPLIT Peter Xu
2023-02-01 18:59 ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 17/21] migration: Rework ram discard logic for hugetlb double-map Peter Xu
2023-02-01 19:03 ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 18/21] migration: Allow postcopy_register_shared_ufd() to fail Peter Xu
2023-02-01 19:09 ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 19/21] migration: Add postcopy_mark_received() Peter Xu
2023-02-01 19:10 ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 20/21] migration: Handle page faults using UFFDIO_CONTINUE Peter Xu
2023-02-01 19:24 ` Juan Quintela
2023-02-01 19:52 ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 21/21] migration: Collapse huge pages again after postcopy finished Peter Xu
2023-02-01 19:49 ` Juan Quintela
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y9AWtl9UUzc8y9QY@work-vm \
--to=dgilbert@redhat.com \
--cc=jthoughton@google.com \
--cc=lsoaresp@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).