Hi Paolo, all, could anyone advise which source file implements memory allocation in KVM? I want to check the source of the corresponding malloc. A simple search says that KVM source tree contains three malloc implementations. -- With best regards / с наилучшими пожеланиями, Alexei Fedotov / Алексей Федотов, http://dataved.ru/ +7 916 562 8095 [1] Start using Apache Openmeetings today, http://openmeetings.apache.org/ [2] Join Alexei Fedotov @linkedin, http://ru.linkedin.com/in/dataved/ [3] Join Alexei Fedotov @facebook, http://www.facebook.com/openmeetings On Mon, Jul 7, 2014 at 1:35 PM, Alexei Fedotov <alexei.fedotov@xxxxxxxxx> wrote: > Paolo, thank you. > -- > With best regards / с наилучшими пожеланиями, > Alexei Fedotov / Алексей Федотов, > http://dataved.ru/ > +7 916 562 8095 > > [1] Start using Apache Openmeetings today, http://openmeetings.apache.org/ > [2] Join Alexei Fedotov @linkedin, http://ru.linkedin.com/in/dataved/ > [3] Join Alexei Fedotov @facebook, http://www.facebook.com/openmeetings > > > On Fri, Jul 4, 2014 at 8:17 PM, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: >> 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 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html