I am trying to set up for some performance profiling and also run-time decisions affecting buffering strategy. My application receives a pointer to a buffer allocated by a library (CUDA or OpenCL).
How can I test that a memory region is page-locked?
As far as I can tell, POSIX gives us mlock()
and munlock()
. How do I effectively check the fictitious mislocked()
?
Answers for Mac OS X or Linux would be helpful.
I've seen several references, such as this and this that suggest the writers of driver librari开发者_如何学Goes have figured out how to make this test. How can I do it in my user code?
/proc/$PID/smaps
contains "Locked:" line which should be enough for simple ensurance whether pages are locked or not. Otherwise see /proc/$PID/pagemap
interface.
精彩评论