[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] question about running vm change its mem maxsize
On Tue, 2007-03-20 at 12:12 +0800, tgh wrote: > Thank you for your reply > > > Daniel Stodden åé: > > On Mon, 2007-03-19 at 20:21 +0800, tgh wrote: > > > >> Thank you for your reply > >> > >> Daniel Stodden åé: > >> > >>> On Mon, 2007-03-19 at 09:20 +0800, tgh wrote: > >>> > >>> > >>>> hi > >>>> I read the code of xc_linux_build() and xc_domain_setmaxmem(),and I am > >>>> confused about how does "xm mem-max" change the max size of mem for > >>>> a running VM > >>>> > >>>> In xc_domain_setmaxmem() ,the XEN_DOMCTL_max_mem has been called ,and > >>>> just does "d->max_pages = new_max;" > >>>> > >>>> > >>> that variable determines the maximum size. the code verifies that the > >>> new size won't be below the previous one, and therefore just needs to > >>> readjust it. > >>> > >>> it doesn't actually have to allocate memory. this is done on demand, > >>> i.e. as soon as the domain references a new page frame within it's > >>> virtual machine address space. > >>> > >>> > >>> > >> I see > >> > >>>> while in the xc_linux_build(), before the vm boots up,the maxsize pfn > >>>> is alloced in an array with fixsize, page_array = malloc(nr_pages * > >>>> sizeof(unsigned long)) > >>>> > >>>> > >>> i suppose you misunderstood what that call really does. it's not > >>> changing the maximum vm size, but allocating the initial number of pages > >>> required to load the guest operating system image into. that's typically > >>> much less than d->max_pages. > >>> > >>> > >>> > >> "page_array = malloc(nr_pages *sizeof(unsigned long))" in xc_linux_build() > >> is not to allocate the physical memory to the VM,then which code or > >> function allocate the phy-mem to the VM? > >> > >> I am confused about it > >> > > > > is see, i'm not sure anymore whether i understand your problem > > correctly. > > > > so lets try going through that more slowly. > > > > not the malloc() above, but the call to > > xc_domain_memory_populate_physmap() allocates memory. domain memory is > > organized in pages. those pages are allocated upon demand by the > > software using it. > > > I search the code ,it seems that > set_vram_mapping()->set_mm_mapping()->xc_domain_memory_populate_physmap() > > > and domain builder acts as bootloader ,and then guestos-linux will > setup and control its own memory ,is it right? of course,any memory-map > will incur xen to related map or so. > but in the rational linux, it will know how many physical memory it owns > and linux know that all the physical memory it owns is there naturally. > In the xen ,guest-linux know how many physical memory it owns but > doesnot know that all the physical memory it owns is there,for some of > them is not to allocate,is it right? this is correct -- for a paravirtual guest. for a hvm guest, it needs to work a little different, of course. > that is during guest-linux > running,it will request some memory which it will get ,for the > guest ,its memory (both its physical memory and its virtual memory)is > dynamical allocated,while raditional linux has its physical memory when > it boot up ,while gets virtual memory dynamically,is it right? yes. see the xen interface manual on this topic, namely the chapters on memory management and the hypercall reference for page table and physical memory management. not sure if this gets entirely clear, though, i sometimes tend to get confused myself. especially guest side vm tends to be complex, but that's quite natural. > could you help me > thanks in advance hth, dns -- Daniel Stodden LRR - Lehrstuhl fÃr Rechnertechnik und Rechnerorganisation Institut fÃr Informatik der TU MÃnchen D-85748 Garching http://www.lrr.in.tum.de/~stodden mailto:stodden@xxxxxxxxxx PGP Fingerprint: F5A4 1575 4C56 E26A 0B33 3D80 457E 82AE B0D8 735B _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |