On Tue, 19 Dec 2006, Shawn Pearce wrote: > > Smaller mmap units may help on some larger projects. For example > 'git whatchanged' shouldn't need to setup page table entries for > the entire pack file when only the front and middle are needed to > obtain the data for the most recent 25 commits, before the user > kills the pager. At least on Linux, we do NOT set up page table entries unnecessarily. The cost of a mmap() is largely independent of the size of the mmap, and the costs will be on page fault time (which is obviously O(n) in number of pages you need). The same is _largely_ true of munmap() too. There's a small cost to large mmaps that were only sparsely accessed being unmapped (we have to look at the page tables closely, even if they end up being empty), but quite frankly, it's not going to be all that noticeable. So mmap() costs end up largely being one (fairly small) fixed cost, plus a (fairly small) cost for each page beign demand-mapped in. Of course, Linux is just _better_ than the competition, so things that don't help Linux might still help other systems. Linux does both page faults and the mmap system call well, other systems will generally be an order of magnitude worse in both. And as we've seen, it can be more. (Things that are really fast on Linux: VM manipulation, and filename path lookup. Those are both ops that Linux _really_ shines on. It may not sound like much, but when you do millions of them, it's the difference between seconds and hours). Linus - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html