I have the following scenario:
qemu-kvm(guest) ---has virtual memory, get physical--->
virtio (send physical address to host) ---map physical to host virtual memory--->
host
The physical memory is preallocated. Is there a method to preallocate non mapped virtual memory on the host so that it won't have to search for free virtual address spaces?
Would this be a justifiable design concern if the buffers are pretty big?
The end result that I want is a pool of virtual address spaces to map received buffers.
After every job I want to unmap them and send them back the virtual address space to the pool.
linux kernel preallocated non mapped virtual memory
422 views Asked by Catalin Vasile At
1
To reserve a virtual memory range without actually committing any physical pages to it, pass
PROT_NONE
as protection parameter tommap()
. Later on, you can usemprotect()
on that range to make it readable/writable when necessary - the kernel will commit the physical pages on first access. When you're done, you can usemprotect()
again to reset the protection status of the address range back toPROT_NONE
.