title: Why is CUDA pinned memory so fast?
body: <p>I observe substantial speedups in data transfer when I use pinned memory for CUDA data transfers. On linux, the underlying system call for achieving this is mlock. From the man page of mlock, it states that locking the page prevents it from being swapped out:</p>
  
  <blockquote>
    <p>mlock() locks pages in the address range starting at addr and continuing for len bytes.  All pages that contain a part of the specified address range are guaranteed to be resident in RAM when the call returns successfully; </p>
  </blockquote>
  
  <p>In my tests, I had a fews gigs of free memory on my system so there was never any risk that the memory pages could've been swapped out yet I still observed the speedup. Can anyone explain what's really going on here?, any insight or info is much appreciated.</p>