Hi, i''m looking for some documentation on how the balloon driver works internally. Can anybody give me a hint were i can find some good doku? I searched wiki.xensource.com and google but was not very successfull. Greetings, -timo -- Timo Benk - B1 Systems GmbH (http://www.b1-systems.de) Jabber ID: fry@jabber.org - ICQ ID: #241877854 PGP Public Key: http://m28s01.vlinux.de/b1_gpg_key.asc _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Hi, i''m looking for some documentation on how the balloon driver works internally. Can anybody give me a hint were i can find some good doku? I searched wiki.xensource.com and google but was not very successfull. Greetings, -timo -- Timo Benk - B1 Systems GmbH (http://www.b1-systems.de) Jabber ID: fry@jabber.org - ICQ ID: #241877854 PGP Public Key: http://m28s01.vlinux.de/b1_gpg_key.asc _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Mark Williamson
2006-Oct-09 17:08 UTC
Re: [Xen-users] Balloon Driver Documentation/Description
> i''m looking for some documentation on how the balloon driver works > internally. > > Can anybody give me a hint were i can find some good doku?Some of the papers on Xen (see "Xen and the art of virtualisation", for instance) describe this, but not in much detail. The idea actually came from VMware''s ESX server product originally.> I searched wiki.xensource.com and google but was not very successfull.The code is also good documentation, if a little hard to follow before you know what it does. Basically, the balloon driver allocates memory using standard kernel allocation functions, then gives it back to Xen. The memory is no longer available to use in the guest at this point, and the fact that it was allocated by the balloon driver prevents the rest of the kernel from trying to use it. When the balloon driver reclaims memory, it gets it back from Xen and then does a "free", allowing the kernel memory allocator to give it to other drivers for normal use. The balloon driver contains a load of book keeping regarding these operations, certain mechanics to actually make the whole thing work properly, and a few other memory operations that are used by Xen drivers. HTH some, Cheers, mark -- Dave: Just a question. What use is a unicyle with no seat? And no pedals! Mark: To answer a question with a question: What use is a skateboard? Dave: Skateboards have wheels. Mark: My wheel has a wheel! _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Mark Williamson wrote:>> i''m looking for some documentation on how the balloon driver works >> internally. >> >> Can anybody give me a hint were i can find some good doku? > > Basically, the balloon driver allocates memory using standard kernel > allocation functions, then gives it back to Xen. The memory is no longer > available to use in the guest at this point, and the fact that it was > allocated by the balloon driver prevents the rest of the kernel from trying > to use it. > > When the balloon driver reclaims memory, it gets it back from Xen and then > does a "free", allowing the kernel memory allocator to give it to other > drivers for normal use. >That is my understanding of the balloon driver. What i do not understand is, if the balloon driver consists just of a frontend part in DomU that is allocating some memory, and a backend driver in Dom0, that gives that memory back, why is the output of the free command correct? What i want to say is the following: xendom1:~ # free total used free Mem: 786432 117104 669328 xendom1:~ # echo -n "536870912" > /proc/xen/balloon xendom1:~ # free total used free Mem: 524288 116664 407624 Why is the total amount of RAM also changing. If the balloon driver just allocates the memory, the used value should raise, but the total value should stay. I am not a kernel hacker, but i think i need to take a look into the code to understand that. Greetings, -timo -- Timo Benk - Jabber ID: fry@jabber.org - ICQ ID: #241877854 PGP Public Key: http://m28s01.vlinux.de/timo_benk_gpg_key.asc _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Mark Williamson
2006-Oct-13 01:05 UTC
Re: [Xen-users] Balloon Driver Documentation/Description
> That is my understanding of the balloon driver. What i do not understand > is, if the balloon driver consists just of a frontend part in DomU that > is allocating some memory, and a backend driver in Dom0, that gives that > memory back, why is the output of the free command correct? > > What i want to say is the following: > > xendom1:~ # free > total used free > Mem: 786432 117104 669328 > > xendom1:~ # echo -n "536870912" > /proc/xen/balloon > > xendom1:~ # free > total used free > Mem: 524288 116664 407624 > > Why is the total amount of RAM also changing. If the balloon driver just > allocates the memory, the used value should raise, but the total value > should stay.Ooooooh. I don''t think it used to do this, so presumably it''s got cleverer since I last tried it out.> I am not a kernel hacker, but i think i need to take a look into the > code to understand that.Look for references to totalram_pages proc_misc::meminfo_read_proc() is responsible for generating the output of /proc/meminfo, which in turn is used by free. The total amount of ram is determined by the value in totalram_pages, which gets updated by the balloon driver. Hence the value of free is updated correctly, even though behind the scenes the ballooon driver works by allocating memory and giving it to Xen. It just hides this implementation detail from the user, AFAIK. HTH, Cheers, Mark -- Dave: Just a question. What use is a unicyle with no seat? And no pedals! Mark: To answer a question with a question: What use is a skateboard? Dave: Skateboards have wheels. Mark: My wheel has a wheel! _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users