qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] linux-user: fix page table trashing when mmap/munmap called


From: Nikolay Igotti
Subject: [PATCH 1/3] linux-user: fix page table trashing when mmap/munmap called frequently on large regions
Date: Mon, 20 Apr 2020 12:13:20 +0300

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 <address@hidden>

---

 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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]