Messages in this thread | | | Subject | Shared page tables patch... some results | From | Arjan van de Ven <> | Date | Tue, 15 Aug 2006 12:34:07 +0200 |
| |
Hi,
until OLS of this year, most people thought that Dave's shared page table patch was effectively a database-only hack, and thus not all that interesting...
however it's also possible to use shared page tables for shared libraries, and thus the gain is MUCH wider in scope. Dave has been so kind as to send me his latest patch, and I've done some measurements on my new x86-64 test machine (which runs FC6-test2)...
and the result is interesting: Just booting into runlevel 5 and logging into gnome (without starting any apps) gets a sharing of 1284 pte pages! This means that five megabytes (!!) of memory is saved, and countless pagefaults are avoided.
Now, as Dave discussed in Ottawa, there is one so-far unsolved gotcha with shared pagetables: RSS accounting.
The problem is that if application A and B both map a file C, and end up sharing the pagetable.. page faults that A gets are accounted as the rss for A, but not in the RSS for B, even though the page is now in the pagetables for application B.
One possible solution would be to upper-bound estimage the RSS cost of shareable file mappings to the mapping size; another possible angle is to dynamically calculate the RSS for file backed mappings (by storing the rss count in the struct page of the pagetable, and then iterate over these).
But.. I'm really hoping someone out here has some other smart idea; it'd be really nice to get this working really well.. after all it's a memory saving for everyone!
Greetings, Arjan van de Ven
Notes about the measurement of the number 1284 [1] This only works on x86-64, not i386. For this to work the libraries need to be mapped at a granularity of 2Mb; i386 uses 4Kb which is too small [2] This only works if you use a new enough binutils (such as FC6-test has); older versions of binutils used 1Mb not 2Mb as alignment. [3] It really helps to use prelink (as I did), prelink makes sure that a library is on the same virtual address in all applications, which is basically a requirement for sharing the pagetables
-- if you want to mail me at work (you don't), use arjan (at) linux.intel.com
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |