qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Memory use with >100 virtio devices
Date: Mon, 21 Aug 2017 14:31:25 +1000	[thread overview]
Message-ID: <20170821043125.GH12356@umbus.fritz.box> (raw)
In-Reply-To: <20170818131853.GB17654@stefanha-x1.localdomain>

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

On Fri, Aug 18, 2017 at 02:18:53PM +0100, Stefan Hajnoczi wrote:
> On Fri, Aug 18, 2017 at 03:39:20PM +1000, Alexey Kardashevskiy wrote:
> > ==94451== -------------------- 4 of 10 --------------------
> > ==94451== max-live:    314,649,600 in 150 blocks
> > ==94451== tot-alloc:   314,649,600 in 150 blocks (avg size 2097664.00)
> > ==94451== deaths:      none (none of these blocks were freed)
> > ==94451== acc-ratios:  0.00 rd, 0.00 wr  (0 b-read, 0 b-written)
> > ==94451==    at 0x4895600: memalign (in
> > /usr/lib/valgrind/vgpreload_exp-dhat-ppc64le-linux.so)
> > ==94451==    by 0x48957E7: posix_memalign (in
> > /usr/lib/valgrind/vgpreload_exp-dhat-ppc64le-linux.so)
> > ==94451==    by 0xB744AB: qemu_try_memalign (oslib-posix.c:106)
> > ==94451==    by 0xA92053: qemu_try_blockalign (io.c:2493)
> > ==94451==    by 0xA34DDF: qcow2_do_open (qcow2.c:1365)
> > ==94451==    by 0xA35627: qcow2_open (qcow2.c:1526)
> > ==94451==    by 0x9FB94F: bdrv_open_driver (block.c:1109)
> > ==94451==    by 0x9FC413: bdrv_open_common (block.c:1365)
> > ==94451==    by 0x9FF823: bdrv_open_inherit (block.c:2542)
> > ==94451==    by 0x9FFC17: bdrv_open (block.c:2626)
> > ==94451==    by 0xA71027: blk_new_open (block-backend.c:267)
> > ==94451==    by 0x6D3E6B: blockdev_init (blockdev.c:588)
> 
> This allocation is unnecessary.  Most qcow2 files are not encrypted so
> s->cluster_data does not need to be allocated upfront.
> 
> I'll send a patch.

Is that sufficient to explain the problem, I can't quickly see how big
that unnecessary allocation is - but would it account for the 10s of
gigabytes usage we're seeing here?

I'm suspecting we accidentally have a O(n^2) or worse space complexity
going on here.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-08-21  4:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-18  5:39 [Qemu-devel] Memory use with >100 virtio devices Alexey Kardashevskiy
2017-08-18 13:18 ` Stefan Hajnoczi
2017-08-21  4:31   ` David Gibson [this message]
2017-08-21  5:50     ` Alexey Kardashevskiy
2017-08-24  9:48       ` Alexey Kardashevskiy
2017-08-24 12:30         ` David Gibson
2017-08-25  8:31           ` [Qemu-devel] [RFC PATCH qemu] exec: Destroy dispatch immediately Alexey Kardashevskiy
2017-08-25  8:53             ` Paolo Bonzini
2017-08-25  9:22               ` Peter Maydell
2017-08-25  9:57                 ` Paolo Bonzini
2017-08-25 13:19                   ` David Gibson
2017-08-25 13:46                     ` Peter Maydell
2017-08-25 14:04                     ` Paolo Bonzini
2017-08-29  8:55               ` Alexey Kardashevskiy
2017-08-25  8:55             ` Paolo Bonzini
2017-08-25  9:01             ` Paolo Bonzini
2017-08-25  9:16               ` Alexey Kardashevskiy
2017-08-25  9:58                 ` Paolo Bonzini
2017-08-25 10:48           ` [Qemu-devel] Memory use with >100 virtio devices Paolo Bonzini

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=20170821043125.GH12356@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=aik@ozlabs.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.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).