Re: Better pagecache statistics ?

Badari Pulavarty
2005-12-02T22:31:45Z

On Fri, 2005-12-02 at 17:15 -0500, Frank Ch. Eigler wrote:
> Badari Pulavarty <pbadari@us.ibm.com> writes:
>
> > > Can't you add hooks to add_to_page_cache/remove_from_page_cache
> > > to record pagecache activity ?
> >
> > In theory, yes. We already maintain info in "mapping->nrpages".
> > Trick would be to collect all of them, send them to user space.
>
> If you happened to have a copy of systemtap built, you might run this
> script instead of inserting static hooks into your kernel. (The tool
> has come some way since the OLS '2005 demo.)
>
> #! stap
> probe kernel.function("add_to_page_cache") {
> printf("pid %d added pages (%d)\n", pid(), $mapping->nrpages)
> }
> probe kernel.function("__remove_from_page_cache") {
> printf("pid %d removed pages (%d)\n", pid(), $page->mapping->nrpages)
> }

Yes. This is what I also did earlier to test. But unfortunately,
we need more than this.

Having by "pid" basis is not good enough. I need per file/mapping
basis collected and sent to user-space on-demand. Is systemtap
hooked to relayfs to send data across to user-land ? printf() is
not an option. And also, I need to have this probe, installed
from the boot time and collecting all the information - so I can
access it when I need it - which means this bloats kernel memory.
Isn't it ?

Thanks,
Badari