On Linux, how do you determine which individual pages are resident?
How can one determine which individual pages are resident (i.e., committed in RAM)? On Linux, /proc/pid/smaps gives, for a fixed set of ranges, how many bytes are resident in that range, but this information doesn't tell you what actual ranges of memory are resident.
As for what this is intended to be used for: I already have data associating allocation ranges with the source line info. This is useful for finding who is allocating how much. Given resident mem开发者_运维知识库ory ranges, I could correlate the data to find who is allocating how much memory that was being kept resident.
Thanks!
There is a syscall to do this:
mincore - determine whether pages are resident in memory
int mincore(void *addr, size_t length, unsigned char *vec);
精彩评论