[lkml]   [2006]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectShared page tables patch... some results

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

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

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!

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
[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)

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-08-15 12:37    [W:0.062 / U:8.844 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site