qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH] qcow2: do lazy allocation of the L2 cache


From: Kevin Wolf
Subject: Re: [Qemu-block] [PATCH] qcow2: do lazy allocation of the L2 cache
Date: Fri, 24 Apr 2015 11:52:14 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 24.04.2015 um 11:26 hat Stefan Hajnoczi geschrieben:
> The posix_memalign() call wastes memory.  I compared:
> 
>   posix_memalign(&memptr, 65536, 2560 * 65536);
>   memset(memptr, 0, 2560 * 65536);
> 
> with:
> 
>   for (i = 0; i < 2560; i++) {
>       posix_memalign(&memptr, 65536, 65536);
>       memset(memptr, 0, 65536);
>   }

64k alignment is too much, in practice you need 512b or 4k, which
probably wastes a lot less memory.

But I just looked at the qcow2 cache code and you're right anyway.
Allocating one big block instead of many small allocations in a loop
looks like a good idea either way.

Kevin

Attachment: pgpcIHzFs9L1T.pgp
Description: PGP signature


reply via email to

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