From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexei Fedotov <alexei.fedotov@gmail.com>, kvm@vger.kernel.org
Subject: Re: qemu/kvm memory allocation
Date: Fri, 04 Jul 2014 18:17:27 +0200 [thread overview]
Message-ID: <53B6D397.7030205@redhat.com> (raw)
In-Reply-To: <CAGc_3jG4EM9333hu452E5ZopZt+MjDtmdMUejw8yCuXLxB=D-g@mail.gmail.com>
Il 04/07/2014 16:49, Alexei Fedotov ha scritto:
> Hi engineers,
>
> Could anyone direct me where memory allocation [1] for a new virtual
> machine takes place in the code? I want to understand why the memory
> is initialized with zeroes when I call malloc in a virtual machine.
Nowhere in KVM.
Memory allocation happens in userspace, which usually (but not
necessarily) means QEMU. Quoting from the wiki page you mentioned:
> The qemu/kvm process runs mostly like a normal Linux program. It
> allocates its memory with normal malloc() or mmap() calls. If a guest is
> going to have 1GB of physical memory, qemu/kvm will effectively do a
> malloc(1<<30), allocating 1GB of host virtual space. However, just like
> a normal program doing a malloc(), there is no actual physical memory
> allocated at the time of the malloc(). It will not be actually allocated
> until the first time it is touched.
Paolo
next prev parent reply other threads:[~2014-07-04 16:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-04 14:49 qemu/kvm memory allocation Alexei Fedotov
2014-07-04 16:17 ` Paolo Bonzini [this message]
2014-07-07 9:35 ` Alexei Fedotov
2014-07-11 14:35 ` Alexei Fedotov
2014-07-11 14:58 ` Paolo Bonzini
2014-07-11 15:27 ` Anshul Makkar
2014-07-11 15:28 ` Alexei Fedotov
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=53B6D397.7030205@redhat.com \
--to=pbonzini@redhat.com \
--cc=alexei.fedotov@gmail.com \
--cc=kvm@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.