linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Badari Pulavarty <pbadari@us.ibm.com>
To: "Frank Ch. Eigler" <fche@redhat.com>
Cc: Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
	Arjan van de Ven <arjan@infradead.org>,
	linux-mm <linux-mm@kvack.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: Better pagecache statistics ?
Date: Fri, 02 Dec 2005 15:46:46 -0800	[thread overview]
Message-ID: <1133567206.21429.117.camel@localhost.localdomain> (raw)
In-Reply-To: <20051202224645.GB6576@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2481 bytes --]

On Fri, 2005-12-02 at 17:46 -0500, Frank Ch. Eigler wrote:
> Hi -
> 
> On Fri, Dec 02, 2005 at 02:31:56PM -0800, Badari Pulavarty wrote:
> > On Fri, 2005-12-02 at 17:15 -0500, Frank Ch. Eigler wrote:
> > [...]
> > > #! 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)
> > > }
> >
> > [...]  Having by "pid" basis is not good enough. I need per
> > file/mapping basis collected and sent to user-space on-demand.
> 
> If you can characterize all your data needs in terms of points to
> insert hooks (breakpoint addresses) and expressions to sample there,
> systemtap scripts can probably track the relationships.  (We have
> associative arrays, looping, etc.)
> 
> > Is systemtap hooked to relayfs to send data across to user-land ?
> > printf() is not an option.
> 
> systemtap can optionally use relayfs.  The printf you see here does
> not relate to/invoke the kernel printk, if that's what you're worried
> about.

Hmm. You are right.

Is there a way another user-level program/utility access some of the
data maintained in those arrays ?

> 
> > 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
> 
> We haven't done much work yet to address on-demand kind of interaction
> with a systemtap probe session.  However, one could fake it by
> associating data-printing operations with events that are triggered
> purposely from userspace, like running a particular system call from a
> particularly named process.
> 
> > which means this bloats kernel memory. [...]
> 
> The degree of bloat is under the operator's control: systemtap only
> uses initialization-time memory allocation, so its arrays can fill up.

Does this mean that I can do something like

	page_cache[0xffff8100c4c6b298] = $mapping->nrpages ?

And this won't generate bloated arrays ?

Here is what I wrote earlier to capture some of the pagecache data.
Unfortunately, I can't capture whatever happend before inserting the
problem. So it won't give me information about all whats there in the
pagecache.

BTW, if you prefer - we can move the discussion to systemtap.
(I have few questions/issues on ret probes & accessability of
arguments - since I want to do this on return).

Thanks,
Badari





[-- Attachment #2: pagecache.stp --]
[-- Type: text/plain, Size: 502 bytes --]

#! stap

global page_cache_pages

function _(n) { return string(n) } 

probe kernel.function("add_to_page_cache") {
	page_cache_pages[$mapping] = $mapping->nrpages
}

probe kernel.function("__remove_from_page_cache") {
	page_cache_pages[$page->mapping] = $page->mapping->nrpages
}

function report () {
  foreach (mapping in page_cache_pages) {
	print("mapping = " . hexstring(mapping) . 
		" nrpages = " . _(page_cache_pages[mapping]) . "\n")
  }
  delete page_cache_pages
}

probe end {
  report()
}

  reply	other threads:[~2005-12-02 23:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-30 18:57 Badari Pulavarty
2005-12-01  2:35 ` Hareesh Nagarajan
2005-12-01 15:20 ` Marcelo Tosatti
2005-12-01 15:59   ` Badari Pulavarty
2005-12-01 16:10     ` Arjan van de Ven
2005-12-01 16:23       ` Badari Pulavarty
2005-12-01 17:08       ` Marcelo Tosatti
2005-12-01 17:15         ` Badari Pulavarty
2005-12-01 17:21           ` Arjan van de Ven
2005-12-01 17:57             ` Marcelo Tosatti
2005-12-01 18:20               ` Badari Pulavarty
2005-12-02 22:15                 ` Frank Ch. Eigler
2005-12-02 22:31                   ` Badari Pulavarty
2005-12-02 22:46                     ` Frank Ch. Eigler
2005-12-02 23:46                       ` Badari Pulavarty [this message]
2005-12-01 18:24               ` Badari Pulavarty
2005-12-04 18:48           ` Martin J. Bligh
2005-12-01 17:19     ` Marcelo Tosatti
2005-12-01 17:31       ` Badari Pulavarty
2005-12-01 18:15         ` Marcelo Tosatti
2005-12-01 18:25           ` Badari Pulavarty
2005-12-01 16:00   ` Marcelo Tosatti
2005-12-01 21:16     ` Christoph Lameter
2005-12-02  0:13       ` Badari Pulavarty
2005-12-28  1:33   ` Marcelo Tosatti
2005-12-28 19:36     ` Tom Zanussi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1133567206.21429.117.camel@localhost.localdomain \
    --to=pbadari@us.ibm.com \
    --cc=arjan@infradead.org \
    --cc=fche@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=marcelo.tosatti@cyclades.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox