开发者

Is memory locked (pinned) or not?

开发者 https://www.devze.com 2023-03-30 19:13 出处:网络
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).

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消