4

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 libraries have figured out how to make this test. How can I do it in my user code?

Community
  • 1
  • 1
NoahR
  • 1,417
  • 3
  • 18
  • 33

1 Answers1

2

/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.

adobriyan
  • 2,594
  • 16
  • 8
  • Finally able to test this on a linux system. This is an OK approach. Was hoping for something I could call more readily from my program, but I can work with it. I'm just holding out a bit longer to see if anyone can suggest an OS X approach which does not implement the proc pseudo-filesystem. – NoahR Aug 25 '11 at 04:08