Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Optimization updating memory usage via mincore syscall is expensive #1234
When sentry update memory usage, mincore syscall will be used to check whether pages are resident in memory, this is expensive for CPU utilization, because syscall in sentry kernel will invoke a vmexit and kernel syscall.
Mincore syscall will cause about 1%~%5 CPU utilization in all Guest ring 0 and Host ring 0 CPU utilization of our Java / Go application container.
The issue could be emulated with following case, a memory allocate and free program, a meminfo read program, run this two program.
memory allocate and free program
#define MAX_SIZE (102410241024)
/proc/meminfo reading program
There are likely other implications (e.g. huge pages) but I’d be curious what happens if the MapUnit in kvm is set to usermem.PageSize.
In theory, we should be able to actually mark this as used on the fault itself, and there should be no mincore required.