[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 8/9] migration/ram: Factor out populating pages readable i
From: |
Peter Xu |
Subject: |
Re: [PATCH v4 8/9] migration/ram: Factor out populating pages readable in ram_block_populate_pages() |
Date: |
Thu, 2 Sep 2021 18:28:56 -0400 |
On Thu, Sep 02, 2021 at 03:14:31PM +0200, David Hildenbrand wrote:
> Let's factor out prefaulting/populating to make further changes easier to
> review. While at it, use the actual page size of the ramblock, which
> defaults to qemu_real_host_page_size for anonymous memory.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
> migration/ram.c | 21 ++++++++++++---------
> 1 file changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/migration/ram.c b/migration/ram.c
> index e1c158dc92..de47650c90 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -1639,6 +1639,17 @@ out:
> return ret;
> }
>
> +static inline void populate_range(RAMBlock *block, ram_addr_t offset,
> + ram_addr_t size)
> +{
> + for (; offset < size; offset += block->page_size) {
> + char tmp = *((char *)block->host + offset);
> +
> + /* Don't optimize the read out */
> + asm volatile("" : "+r" (tmp));
> + }
> +}
If to make it a common function, make it populate_range_read()?
Just to identify from RW, as we'll fill the holes with zero pages only, not
doing page allocations yet, so not a complete "populate".
That'll be good enough for live snapshot as uffd-wp works for zero pages,
however I'm just afraid it may stop working for some new users of it when zero
pages won't suffice.
Maybe some comment would help too?
--
Peter Xu
- [PATCH v4 5/9] virtio-mem: Drop precopy notifier, (continued)
- [PATCH v4 5/9] virtio-mem: Drop precopy notifier, David Hildenbrand, 2021/09/02
- [PATCH v4 6/9] migration/postcopy: Handle RAMBlocks with a RamDiscardManager on the destination, David Hildenbrand, 2021/09/02
- [PATCH v4 7/9] migration: Simplify alignment and alignment checks, David Hildenbrand, 2021/09/02
- Re: [PATCH v4 7/9] migration: Simplify alignment and alignment checks, Peter Xu, 2021/09/02
- Re: [PATCH v4 7/9] migration: Simplify alignment and alignment checks, David Hildenbrand, 2021/09/03
- Re: [PATCH v4 7/9] migration: Simplify alignment and alignment checks, David Hildenbrand, 2021/09/03
- Re: [PATCH v4 7/9] migration: Simplify alignment and alignment checks, David Hildenbrand, 2021/09/03
- Re: [PATCH v4 7/9] migration: Simplify alignment and alignment checks, Peter Xu, 2021/09/03
- Re: [PATCH v4 7/9] migration: Simplify alignment and alignment checks, David Hildenbrand, 2021/09/03
[PATCH v4 8/9] migration/ram: Factor out populating pages readable in ram_block_populate_pages(), David Hildenbrand, 2021/09/02
- Re: [PATCH v4 8/9] migration/ram: Factor out populating pages readable in ram_block_populate_pages(),
Peter Xu <=
- Re: [PATCH v4 8/9] migration/ram: Factor out populating pages readable in ram_block_populate_pages(), David Hildenbrand, 2021/09/03
- Re: [PATCH v4 8/9] migration/ram: Factor out populating pages readable in ram_block_populate_pages(), David Hildenbrand, 2021/09/03
- Re: [PATCH v4 8/9] migration/ram: Factor out populating pages readable in ram_block_populate_pages(), Peter Xu, 2021/09/03
- Re: [PATCH v4 8/9] migration/ram: Factor out populating pages readable in ram_block_populate_pages(), David Hildenbrand, 2021/09/03
- Re: [PATCH v4 8/9] migration/ram: Factor out populating pages readable in ram_block_populate_pages(), David Hildenbrand, 2021/09/03
[PATCH v4 9/9] migration/ram: Handle RAMBlocks with a RamDiscardManager on background snapshots, David Hildenbrand, 2021/09/02