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 upOptimization updating memory usage via mincore syscall is expensive #1234
Comments
This comment has been minimized.
This comment has been minimized.
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 #include <stdio.h> #define MAX_SIZE (102410241024) void main(void)
} /proc/meminfo reading program #include <sys/types.h> int main(void){
} |
This comment has been minimized.
This comment has been minimized.
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. |
This comment has been minimized.
This comment has been minimized.
Thanks @amscanne , I tried to change MapUnit into usermem.PageSize, test in my test environment, the mincore stil has the same cost of CPU. |
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.