Given a virtual address, I want to know if the memory page mapped into this virtual address has been loaded into memory or in disck. Is there anyway to do check that in user level program? I am using CentOS 7.
Advertisement
Answer
You can use the mincore
system call for this.
mincore – determine whether pages are resident in memory
It will tell you which pages in a range are in memory and will not require disk I/O upon access. Note that pages may be swapped out between mincore
returning and you accessing them.