* qemu/kvm memory allocation @ 2014-07-04 14:49 Alexei Fedotov 2014-07-04 16:17 ` Paolo Bonzini 0 siblings, 1 reply; 7+ messages in thread From: Alexei Fedotov @ 2014-07-04 14:49 UTC (permalink / raw) To: kvm 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. [1] http://www.linux-kvm.org/page/Memory -- 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: qemu/kvm memory allocation 2014-07-04 14:49 qemu/kvm memory allocation Alexei Fedotov @ 2014-07-04 16:17 ` Paolo Bonzini 2014-07-07 9:35 ` Alexei Fedotov 0 siblings, 1 reply; 7+ messages in thread From: Paolo Bonzini @ 2014-07-04 16:17 UTC (permalink / raw) To: Alexei Fedotov, kvm 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: qemu/kvm memory allocation 2014-07-04 16:17 ` Paolo Bonzini @ 2014-07-07 9:35 ` Alexei Fedotov 2014-07-11 14:35 ` Alexei Fedotov 0 siblings, 1 reply; 7+ messages in thread From: Alexei Fedotov @ 2014-07-07 9:35 UTC (permalink / raw) To: Paolo Bonzini; +Cc: kvm 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@redhat.com> 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: qemu/kvm memory allocation 2014-07-07 9:35 ` Alexei Fedotov @ 2014-07-11 14:35 ` Alexei Fedotov 2014-07-11 14:58 ` Paolo Bonzini 0 siblings, 1 reply; 7+ messages in thread From: Alexei Fedotov @ 2014-07-11 14:35 UTC (permalink / raw) To: Paolo Bonzini; +Cc: kvm 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@gmail.com> 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@redhat.com> 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: qemu/kvm memory allocation 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 0 siblings, 2 replies; 7+ messages in thread From: Paolo Bonzini @ 2014-07-11 14:58 UTC (permalink / raw) To: Alexei Fedotov; +Cc: kvm Il 11/07/2014 16:35, Alexei Fedotov ha scritto: > 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. I'm not even sure what you're talking about, since I already told you that the KVM hypervisor does not do any memory allocation. Paolo ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: qemu/kvm memory allocation 2014-07-11 14:58 ` Paolo Bonzini @ 2014-07-11 15:27 ` Anshul Makkar 2014-07-11 15:28 ` Alexei Fedotov 1 sibling, 0 replies; 7+ messages in thread From: Anshul Makkar @ 2014-07-11 15:27 UTC (permalink / raw) To: Paolo Bonzini; +Cc: Alexei Fedotov, kvm kvm and QEMU are different.. On Fri, Jul 11, 2014 at 4:58 PM, Paolo Bonzini <pbonzini@redhat.com> wrote: > Il 11/07/2014 16:35, Alexei Fedotov ha scritto: > >> 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. > > > I'm not even sure what you're talking about, since I already told you that > the KVM hypervisor does not do any memory allocation. > > > Paolo > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: qemu/kvm memory allocation 2014-07-11 14:58 ` Paolo Bonzini 2014-07-11 15:27 ` Anshul Makkar @ 2014-07-11 15:28 ` Alexei Fedotov 1 sibling, 0 replies; 7+ messages in thread From: Alexei Fedotov @ 2014-07-11 15:28 UTC (permalink / raw) To: Paolo Bonzini; +Cc: kvm Guys, thanks for guiding me. I'm looking into qemu sources right now. -- 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 11, 2014 at 6:58 PM, Paolo Bonzini <pbonzini@redhat.com> wrote: > Il 11/07/2014 16:35, Alexei Fedotov ha scritto: > >> 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. > > > I'm not even sure what you're talking about, since I already told you that > the KVM hypervisor does not do any memory allocation. > > Paolo ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-07-11 15:29 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-07-04 14:49 qemu/kvm memory allocation Alexei Fedotov 2014-07-04 16:17 ` Paolo Bonzini 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox