Am 19.03.2013 um 17:43 schrieb Eric Blake <ebl...@redhat.com>:

> On 03/19/2013 10:18 AM, Peter Lieven wrote:
>> 
>> Am 19.03.2013 um 16:54 schrieb Eric Blake <ebl...@redhat.com>:
>> 
>>> On 03/15/2013 09:50 AM, Peter Lieven wrote:
>>>> Signed-off-by: Peter Lieven <p...@kamp.de>
>>>> ---
>>>> include/qemu-common.h |    2 ++
>>>> util/cutils.c         |   40 ++++++++++++++++++++++++++++++++++++++++
>>>> 2 files changed, 42 insertions(+)
>>>> 
>>> 
>>>> 
>>>> +#define BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR 8
>>> 
>>> Good.
>>> 
>>>> +    assert(len % (BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR 
>>>> +        * sizeof(VECTYPE)) == 0);
>>> 
>>> Good use of it.
>> 
>> A question I had is if these asserts make the code slower? In case of all
>> the 4k pages in RAM migration this could be significant.
> 
> Yes, it probably does slow things down when asserts are enabled.  I'm
> not sure whether it is better to keep the code forcefully robust, or to
> rely on auditing all callers for properly obeying assumptions.  Maybe
> you should wait for an opinion from one of the maintainers.

If I follow your idea to add a can_use_buffer_find_nonzero_offset() function
and add it to the description of the function my feeling is that we can drop 
the asserts.
Actually we are always checking the same things twice.

Peter

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


Reply via email to