qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [v3 02/13] migration: Add the framework of multi-thread


From: Eric Blake
Subject: Re: [Qemu-devel] [v3 02/13] migration: Add the framework of multi-thread compression
Date: Fri, 23 Jan 2015 09:09:12 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 12/11/2014 06:28 PM, Liang Li wrote:
> Signed-off-by: Liang Li <address@hidden>
> Signed-off-by: Yang Zhang <address@hidden>
> ---

> +void migrate_compress_threads_create(MigrationState *s)
> +{
> +    int i, thread_count;
> +
> +    if (!migrate_use_compression()) {
> +        return;
> +    }
> +    quit_thread = false;
> +    thread_count = migrate_compress_threads();
> +    s->compress_thread = g_malloc0(sizeof(QemuThread)
> +        * thread_count);

Theoretically unsafe (well, unsafe if thread_count were unbounded,
although it looks like you artificially cap it at 255 later in the
series); better would be:

s->compress_thread = g_new0(QemuThread, thread_count)

because that catches potential multiplication overflow.

> +    comp_param = g_malloc0(sizeof(compress_param) * thread_count);

Likewise.


>  
> +static int ram_save_compressed_page(QEMUFile *f, RAMBlock* block,

Spacing is off on the second '*'.

> +        ram_addr_t offset, bool last_stage)

Indentation is off.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]