On Mon, Dec 03, 2018 at 10:18:28AM +0800, Wei Wang wrote:
> This patch adds an API to clear bits corresponding to guest free pages
> from the dirty bitmap. Spilt the free page block if it crosses the QEMU
> RAMBlock boundary.
> 
> Signed-off-by: Wei Wang <wei.w.w...@intel.com>
> CC: Dr. David Alan Gilbert <dgilb...@redhat.com>
> CC: Juan Quintela <quint...@redhat.com>
> CC: Michael S. Tsirkin <m...@redhat.com>
> CC: Peter Xu <pet...@redhat.com>
> ---

[...]

> +void qemu_guest_free_page_hint(void *addr, size_t len)
> +{
> +    RAMBlock *block;
> +    ram_addr_t offset;
> +    size_t used_len, start, npages;
> +    MigrationState *s = migrate_get_current();
> +
> +    /* This function is currently expected to be used during live migration 
> */
> +    if (!migration_is_setup_or_active(s->state)) {
> +        return;
> +    }
> +
> +    for (; len > 0; len -= used_len, addr += used_len) {
> +        block = qemu_ram_block_from_host(addr, false, &offset);
> +        if (unlikely(!block || offset > block->used_length)) {

Maybe >=?  My fault if it is...

Reviewed-by: Peter Xu <pet...@redhat.com>

Thanks,

-- 
Peter Xu

Reply via email to