qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Corentin Chary <corentin.chary@gmail.com>
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] virtio-blk: Avoid zeroing every request structure
Date: Tue, 18 May 2010 21:43:37 +0100	[thread overview]
Message-ID: <AANLkTinE2YwJFBAPvcAZtxiWmfAeS5OlHvnJSs6O-VDo@mail.gmail.com> (raw)
In-Reply-To: <AANLkTilrFcs5LVraddwN23dhURfz7BZjiDQcXgUv9LDP@mail.gmail.com>

On Tue, May 18, 2010 at 8:55 PM, Corentin Chary
<corentin.chary@gmail.com> wrote:
> I believe that if the allocation size is large enougth, getting a
> zeroed page can be almost free with clever memory management.
> Could you try to re-run your test with calloc and see what it does ?
> Speeding up all mallocz calls is probably a good idea :)

I think that scenario is libc using mmap to grab zeroed pages from the
kernel.  If the kernel manages zeroed pages so that zeroing is
performed out-of-line (e.g. there is a pool of zeroed pages waiting),
then it appears that calloc() is getting zeroed memory cheaply.

I'll rerun with profiling tomorrow to see if calloc() makes a
difference for general qemu_mallocz() usage.

In the case of virtio-blk requests, we definitely shouldn't be
clearing that memory even if calloc() were cheaper.  Much of the
request structure will not be touched in an average I/O request.
Using zeroed pages is wasteful because they aren't needed here.

Stefan

  reply	other threads:[~2010-05-18 20:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-14 21:52 [Qemu-devel] [PATCH] virtio-blk: Avoid zeroing every request structure Stefan Hajnoczi
2010-05-16 13:25 ` Christoph Hellwig
2010-05-16 15:01   ` Stefan Hajnoczi
2010-05-18  9:36 ` Kevin Wolf
2010-05-18 15:46 ` Jes Sorensen
2010-05-18 16:26   ` Alexander Graf
2010-05-18 16:29     ` Anthony Liguori
2010-05-18 16:31       ` Alexander Graf
2010-05-29 13:07         ` Jamie Lokier
2010-05-18 16:37 ` Corentin Chary
2010-05-18 19:02   ` Stefan Hajnoczi
2010-05-18 19:55     ` Corentin Chary
2010-05-18 20:43       ` Stefan Hajnoczi [this message]
2010-05-21 11:17         ` Stefan Hajnoczi
2010-05-21 17:37           ` [Qemu-devel] [PATCH 0/2] Tidy qemu_malloc Richard Henderson
2010-05-28 22:08             ` Aurelien Jarno
2010-05-21 17:37           ` [Qemu-devel] [PATCH 1/2] Use calloc in qemu_mallocz Richard Henderson
2010-05-21 17:37           ` [Qemu-devel] [PATCH 2/2] linux-user: Use qemu-malloc.c Richard Henderson

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=AANLkTinE2YwJFBAPvcAZtxiWmfAeS5OlHvnJSs6O-VDo@mail.gmail.com \
    --to=stefanha@gmail.com \
    --cc=corentin.chary@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.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).