Re: [PATCH 0/13] maps: pagemap, kpagemap, and related cleanups

Nick Piggin
2007-04-13T03:40:19Z

Andrew Morton wrote:
> On Fri, 13 Apr 2007 12:18:56 +1000 Nick Piggin <nickpiggin@yahoo.com.au> wrote:
>
>
>>>I guess one could generate an answer to the static question with systemtap,
>>>by accumulating running counts across the application lifetime and then
>>>snapshotting them. Sounds hard though.
>>
>>Can't you just traverse arbitrary kernel data structures at a given point
>>in time, exactly like the /proc/ call is doing?
>
>
> Do a full pagetable walk, with all the associated locking from within
> a systemtap script? I'd be surprised. Maybe if it's mostly hand-coded
> in C, perhaps. Then you just end up with the same thing, don't you?

And my problem isn't with the hardcoded pagetable walker. Yeah, we'd
probably still keep the pagetable callback walker thingy with Matt's
associated cleanups (and my subsequent ones to clean it up more and
move it to mm/): there are other in-kernel users for that anyway.

The point is the proc API, and exposing random little parts of deep
kernel internals that some people happen to find useful at the time.
(which is why we have an incredible proliferation of these things).

With systemtap scripts, you could walk pagetables and print *the exact
page information you want*, or you could walk pfns, or LRU, or page_tree,
or walk the page tree then the rmap structures. And you can selectively
cull out items you don't care about if you only care about a subset of
items, based on arbitrary criteria. And you can most likely do all that
more efficiently than with a conglomeration of various /proc files
(assuming they even provide what you want in the first place).

--
SUSE Labs, Novell Inc.