Log memory accesses that cause major page faults
linux, memory, page-fault, perf, systemtap
Solution
See what is available at the probe point:
% stap -L vm.pagefault
vm.pagefault name:string write_access:long address:long $mm:struct mm_struct* \
$vma:struct vm_area_struct* $address:long unsigned int $flags:unsigned int
Log, attempting to map addresses to symbol names
# stap -e 'probe vm.pagefault { if (execname()=="foo") { printf("%p (%s)\n", address, usymdata(address)) } }' -d /bin/foo --ldd
See also: http://sourceware.org/systemtap/examples/#memory/pfaults.stp
Problem
Does anyone know how to get the memory accesses (pointers) that cause page faults? I'm interested mostly in the major page faults. A bit of background about what I'm trying to achieve. I have an application with a large memory footprint (a database) and I want to correlate paging with the accesses to the large data structures (such as tables, indexes which are allocated using mmap()). The mappings of the process are easy to retrieve from /proc//maps. Now, if I have the memory accesses that cause page faults I can track how many page faults are caused when accessing each data structure. I think perf or systemtap could do the job. Any ideas?