eve icon indicating copy to clipboard operation
eve copied to clipboard

xen-tools: Revamp mmap allocation in QEMU

Open temerkhanov opened this issue 4 years ago • 2 comments

Change the algorithm of mmap-based memory allocation to reduce the amount of PTE changes

Signed-off-by: Sergey Temerkhanov [email protected]

temerkhanov avatar Sep 24 '20 07:09 temerkhanov

Instead of calling mmap() twice, we do mmap(...PROT_READ|PROT_WRITE...) + mprotect(PROT_NONE) to get the guard pages

Right @temerkhanov -- I get this -- but what's the benefit of this way of doing things?

rvs avatar Nov 24 '20 03:11 rvs

Instead of calling mmap() twice, we do mmap(...PROT_READ|PROT_WRITE...) + mprotect(PROT_NONE) to get the guard pages

Right @temerkhanov -- I get this -- but what's the benefit of this way of doing things?

At least it reduces amount of noise in memory profilers, and, apparently, the VSZ

temerkhanov avatar Mar 05 '21 03:03 temerkhanov

The patch calls mprotect() on a memory region instead of a second mmap(), expecting, that this will reduce amount of PTE changes, which is not the case: mprotect splits VMA and updates PTE range, so performance benefits are not clear. @eriknordmark let's close this.

rouming avatar Nov 07 '22 20:11 rouming

Closing based on the comment from @rouming above.

eriknordmark avatar Nov 08 '22 11:11 eriknordmark