Re: [PATCH] kvm tools: mmap guest kernel instead of reading it into memory

2011-12-12 Thread Sasha Levin
On Mon, 2011-12-12 at 20:10 +0200, Avi Kivity wrote: On 12/12/2011 04:47 PM, Sasha Levin wrote: This patch mmaps guest kernel into it's own memory slot instead of reading it into the memory. - } else { - /* First RAM range from zero to the PCI gap: */ + /*

[PATCH] kvm tools: mmap guest kernel instead of reading it into memory

2011-12-12 Thread Sasha Levin
This patch mmaps guest kernel into it's own memory slot instead of reading it into the memory. The advantages are: - Smaller memory footprint (same effect as KSM if running multiple guests) - Faster loading of larger kernels. Suggested-by: Sweeney, Andrew John ajsw...@sandia.gov Signed-off-by:

Re: [PATCH] kvm tools: mmap guest kernel instead of reading it into memory

2011-12-12 Thread Pekka Enberg
On Mon, Dec 12, 2011 at 4:47 PM, Sasha Levin levinsasha...@gmail.com wrote: This patch mmaps guest kernel into it's own memory slot instead of reading it into the memory. The advantages are:  - Smaller memory footprint (same effect as KSM if running multiple guests) KSM isn't free so it's

Re: [PATCH] kvm tools: mmap guest kernel instead of reading it into memory

2011-12-12 Thread Sasha Levin
On Mon, 2011-12-12 at 16:54 +0200, Pekka Enberg wrote: On Mon, Dec 12, 2011 at 4:47 PM, Sasha Levin levinsasha...@gmail.com wrote: This patch mmaps guest kernel into it's own memory slot instead of reading it into the memory. The advantages are: - Smaller memory footprint (same effect

Re: [PATCH] kvm tools: mmap guest kernel instead of reading it into memory

2011-12-12 Thread Pekka Enberg
On Mon, Dec 12, 2011 at 4:47 PM, Sasha Levin levinsasha...@gmail.com wrote: +       /* mmap the actual kernel */ +       kvm-bz_fd = dup(fd_kernel); +       kvm-bz_len = st.st_size; +       setup_end = ALIGN(setup_size - PAGE_SIZE, PAGE_SIZE); /* Need it aligned to PAGE_SIZE */ +      

Re: [PATCH] kvm tools: mmap guest kernel instead of reading it into memory

2011-12-12 Thread Sasha Levin
On Mon, 2011-12-12 at 17:59 +0200, Pekka Enberg wrote: On Mon, Dec 12, 2011 at 4:47 PM, Sasha Levin levinsasha...@gmail.com wrote: + /* mmap the actual kernel */ + kvm-bz_fd = dup(fd_kernel); + kvm-bz_len = st.st_size; + setup_end = ALIGN(setup_size - PAGE_SIZE,

Re: [PATCH] kvm tools: mmap guest kernel instead of reading it into memory

2011-12-12 Thread Ingo Molnar
* Sasha Levin levinsasha...@gmail.com wrote: + kvm-bz_start = mmap(NULL, kvm-bz_len, PROT_READ | PROT_WRITE, + MAP_PRIVATE, kvm-bz_fd, setup_end); + /* NOP everything before the kernel start */ + memset(kvm-bz_start, 0x90, setup_size - setup_end);

Re: [PATCH] kvm tools: mmap guest kernel instead of reading it into memory

2011-12-12 Thread Andrew Walrond
On Mon, Dec 12, 2011 at 07:47:35PM +0200, Sasha Levin wrote: Another usecase which I've only first heard about couple of days ago is loading extremely large bzImages. Those images are 300MB+ in size and come with built in filesystem. Apparently it's some sort of a livecd variant. Having a

Re: [PATCH] kvm tools: mmap guest kernel instead of reading it into memory

2011-12-12 Thread Avi Kivity
On 12/12/2011 08:14 PM, Sasha Levin wrote: On Mon, 2011-12-12 at 17:59 +0200, Pekka Enberg wrote: On Mon, Dec 12, 2011 at 4:47 PM, Sasha Levin levinsasha...@gmail.com wrote: + /* mmap the actual kernel */ + kvm-bz_fd = dup(fd_kernel); + kvm-bz_len = st.st_size;

Re: [PATCH] kvm tools: mmap guest kernel instead of reading it into memory

2011-12-12 Thread Avi Kivity
On 12/12/2011 04:47 PM, Sasha Levin wrote: This patch mmaps guest kernel into it's own memory slot instead of reading it into the memory. - } else { - /* First RAM range from zero to the PCI gap: */ + /* Mapped kernel */ + phys_start =

Re: [PATCH] kvm tools: mmap guest kernel instead of reading it into memory

2011-12-12 Thread Avi Kivity
On 12/12/2011 04:47 PM, Sasha Levin wrote: This patch mmaps guest kernel into it's own memory slot instead of reading it into the memory. The advantages are: - Smaller memory footprint (same effect as KSM if running multiple guests) - Faster loading of larger kernels. How many COW faults