qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
	Alberto Garcia <berto@igalia.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] qcow2: do lazy allocation of the L2 cache
Date: Fri, 24 Apr 2015 11:52:14 +0200	[thread overview]
Message-ID: <20150424095214.GB3838@noname.redhat.com> (raw)
In-Reply-To: <20150424092621.GD13278@stefanha-thinkpad.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 638 bytes --]

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 #2: Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2015-04-24  9:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21 15:20 [Qemu-devel] [PATCH] qcow2: do lazy allocation of the L2 cache Alberto Garcia
2015-04-22 10:26 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2015-04-22 14:37   ` Alberto Garcia
2015-04-23 10:15     ` Stefan Hajnoczi
2015-04-23 11:50       ` Alberto Garcia
2015-04-24  9:26         ` Stefan Hajnoczi
2015-04-24  9:45           ` Kevin Wolf
2015-04-24  9:52           ` Kevin Wolf [this message]
2015-04-24 11:10             ` Alberto Garcia
2015-04-24 12:37               ` Stefan Hajnoczi
2015-04-24 12:50                 ` Alberto Garcia
2015-04-24 13:04                   ` Kevin Wolf
2015-05-08  9:00                     ` Alberto Garcia
2015-05-08  9:47                       ` Kevin Wolf
2015-05-08 11:47                         ` Alberto Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150424095214.GB3838@noname.redhat.com \
    --to=kwolf@redhat.com \
    --cc=berto@igalia.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).