It looks to me like MAP_POPULATE
is not just for private mappings, in contradiction to what the man page says:
MAP_POPULATE (since Linux 2.5.46) Populate (prefault) page tables for a mapping. For a file mapping, this causes read-ahead on the file. Later accesses to the mapping will not be blocked by page faults. MAP_POPULATE is only supported for private mappings since Linux 2.6.23.
Based on my cursory inspection of the Linux kernel source for mmap.c, it looks like MAP_POPULATE
has absolutely no relationship with MAP_PRIVATE
whatsoever in versions going back as far as 2.6.34.
Here is an excerpt of the latest code from mmap.c as of the 3.14 kernel implementation:
...
1364 addr = mmap_region(file, addr, len, vm_flags, pgoff);
1365 if (!IS_ERR_VALUE(addr) &&
1366 ((vm_flags & VM_LOCKED) ||
1367 (flags & (MAP_POPULATE | MAP_NONBLOCK)) == MAP_POPULATE))
1368 *populate = len;
1369 return addr;
...
Am I wrong in my observation?