Linux Page Table Walk?
Posted: Wed Feb 11, 2009 6:09 pm
I have a customer who wants me to analyze his use of physical memory on a Linux-based handheld product. I've looked at all the obvious Linux tools for getting memory info, but what I'd really like to be able to do is take a "snapshot" of physical memory, and relate it to running processes. I could, for example, get the information I wanted by dumping /proc/pid/maps for each process, if I could somehow get the physical addresses of all the pages making up each of the virtual memory ranges.
One approach that seems reasonable is to "walk" the page table structure and dump it to a file for post processing. I'm a fairly experienced kernel and driver hacker, but I've never actually done anything with the paging and memory management code. After doing a little reading, I concluded that this would be a fairly straight-forward task -- so straight-forward that I was certain I wouldn't have to do it, there would be some tool out there already that did what I need.
To my surprise, after much searching, I haven't located such a tool. This suggests to me that either (a) I'm not searching for the right thing, or (b) this is a much more challenging task in general that I think.
Can anyone confirm one or both of these notions? In particular, can anyone point me at a tool like what I'm looking for, or alternatively, can anyone explain why this is a really hard thing to do?
One approach that seems reasonable is to "walk" the page table structure and dump it to a file for post processing. I'm a fairly experienced kernel and driver hacker, but I've never actually done anything with the paging and memory management code. After doing a little reading, I concluded that this would be a fairly straight-forward task -- so straight-forward that I was certain I wouldn't have to do it, there would be some tool out there already that did what I need.
To my surprise, after much searching, I haven't located such a tool. This suggests to me that either (a) I'm not searching for the right thing, or (b) this is a much more challenging task in general that I think.
Can anyone confirm one or both of these notions? In particular, can anyone point me at a tool like what I'm looking for, or alternatively, can anyone explain why this is a really hard thing to do?