On Fri, Feb 10, 2012 at 6:35 PM, Stefan Hajnoczi <stefa...@gmail.com> wrote: > On Fri, Feb 10, 2012 at 9:47 AM, Zhi Yong Wu <zwu.ker...@gmail.com> wrote: >> Today i tried to create one VM with the option "-m 4000", and found it >> failed with the following errors: >> >> Failed to allocate 4194304000 B: Cannot allocate memory >> Aborted (core dumped) > > Did you run on a 32-bit host? No, it is one x86_64 host. > >> I checked the qemu code, and found that in qemu_memalign() function, >> posix_memalign() failed to allocate requested memory. Perhaps due to >> No enough memory. >> >> But when i tried with "-m 3000", it can work. >> >> So i have one question about this. How to determine the supported max >> memory size of one VM on one specifc host? > > Since QEMU may use host virtual memory for guest RAM the limit isn't a > hard limit that is easy to describe. If the host OS performs memory > overcommit by default (i.e. will allow processes to map memory without > dedicating that amount of swap), then you can theoretically allocate > up to your address space limit (32-bit or 64-bit) and won't get error Since the host is 64 bits, it should not fail with "-m 4000". I am very surprised at why posix_memalign failed.
> until you begin dirtying more host pages than the host has resources > for. > > But normally for KVM you want sum(vms) < host_ram, unless you are here host_ram is the free ram of host? > betting on KSM to deduplicate guest memory. > > Stefan -- Regards, Zhi Yong Wu