[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4 10/23] xen/arm: introduce allocate_memory
On Sat, 20 Oct 2018, Julien Grall wrote: > > > > + > > > > + pg = alloc_domheap_pages(d, order, 0); > > > > > > So here you impose the memory to be contiguously allocated for a given > > > bank. > > > There are quite a few case where you may not have enough memory to > > > allocate > > > contiguously. > > > > > > So more likely you want to add loop in this code to allocate until order > > > is > > > reached. > > > > This case is not handled today for dom0. > > I am afraid this is slightly untrue. Dom0 memory is direct mapped, Xen will > first try to allocate the using the biggest order. If it fails, the order will > be decreased until the size is suitable. We will always try to allocate the > maximum of memory. > > There are three major problems with your code: > 1) There may not be enough contiguous space in the host memory for a > 4GB region. > 2) The memory specify by the user may not be in power of 2 pages. For > instance, a user can specify 40KB. With your algo, we will end to allocate > 32KB in the first bank and 8KB in the second bank. However what we want is > allocate 40KB in a single bank. > 3) You don't check whether the leftover memory is bigger than the size > of the second bank. > > In the case where the memory is not direct mapped, we should be able to > allocate the whole region with multiple non-contiguous memory. I think the > algorithm in used in libxc (see populate_guest_memory) is working quite well > for this purpose. > > It is also possible to have a simpler solution within the hypervisor. I > quickly wrote a patch (not compiled, nor tested) that should address the 3 > problems above. See: https://pastebin.com/FQ9k9CbL Thank you for your help. Actually I had already written something along the same lines, I don't know why I didn't say it in my reply... I double checked the implementation with yours here and they look equivalent. Good. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |