Some applications, for example Wasmer WebAssembly VM, perform frequent map/unmap of
huge (6G) regions, so when executed under linux-user it leads to creation of many PTE/PDE for the region, and they never get reclaimed. As result, emulator process consumes a lot of RAM. To fix this problem we try to reuse VMA, when possible. Signed-off-by: Nikolay Igotti <igo...@gmail.com> --- linux-user/mmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index e378033797..c1d6163d7a 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -650,6 +650,8 @@ int target_munmap(abi_ulong start, abi_ulong len) if (ret == 0) { page_set_flags(start, start + len, 0); tb_invalidate_phys_range(start, start + len); + if (start < mmap_next_start) + mmap_next_start = start; } mmap_unlock(); return ret; -- 2.24.2 (Apple Git-127)