title: Linux MMAP internals
body: <p>I have several questions regarding the <code>mmap</code> implementation in Linux systems which don't seem to be very much documented:</p>
  
  <p>When mapping a file to memory using <code>mmap</code>, how would you handle prefetching the data in such file?</p>
  
  <p>I.e. what happens when you read data from the mmaped region? Is that data moved to the L1/L2 caches? Is it read directly from disk cache? Does the <code>prefetchnta</code> and similar ASM instructions work on <code>mmap</code>ed zones?</p>
  
  <p>What's the overhead of the actual <code>mmap</code> call? Is it relative to the amount of mapped data, or constant?</p>
  
  <p>Hope somebody has some insight into this. Thanks in advance.</p>