All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: Badari Pulavarty <pbadari@us.ibm.com>
Cc: linux-mm <linux-mm@kvack.org>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: Better pagecache statistics ?
Date: Thu, 1 Dec 2005 13:20:29 -0200	[thread overview]
Message-ID: <20051201152029.GA14499@dmt.cnet> (raw)
In-Reply-To: <1133377029.27824.90.camel@localhost.localdomain>


Hi Badari,

On Wed, Nov 30, 2005 at 10:57:09AM -0800, Badari Pulavarty wrote:
> Hi,
> 
> Is there a effort/patches underway to provide better pagecache
> statistics ? 
> 
> Basically, I am interested in finding detailed break out of
> cached pages. ("Cached" in /proc/meminfo) 
> 
> Out of this "cached pages"
> 
> - How much is just file system cache (regular file data) ?
> - How much is shared memory pages ?

You could do that from userspace probably, by doing some math 
on all processes statistics versus global stats, but does not 
seem very practical.

> - How much is mmaped() stuff ?

That would be "nr_mapped".

> - How much is for text, data, bss, heap, malloc ?

Hum, the core pagecache code does not deal with such details, 
so adding (and maintaining) accounting there does not seem very 
practical either.

You could walk /proc/<pid>/{maps,smaps} and account for different
types of pages.

$ cat /proc/self/smaps

bf8df000-bf8f4000 rw-p bf8df000 00:00 0          [stack]
Size:                84 kB
Rss:                  8 kB
Shared_Clean:         0 kB
Shared_Dirty:         0 kB
Private_Clean:        0 kB
Private_Dirty:        8 kB

0975b000-0977c000 rw-p 0975b000 00:00 0          [heap]
Size:               132 kB
Rss:                  4 kB
Shared_Clean:         0 kB
Shared_Dirty:         4 kB
Private_Clean:        0 kB
Private_Dirty:        0 kB 

But doing it from userspace does not guarantee much precision
since the state can change while walking the proc stats.

> What is the right way of getting this kind of data ? 
> I was trying to add tags when we do add_to_page_cache()
> and quickly got ugly :(

Problem is that any kind of information maybe be valuable,
depending on what you're trying to do.

For example, one might want to break statistics in /proc/vmstat
and /proc/meminfo on a per-zone basis (for instance there is no 
per-zone "locked" accounting at the moment), per-uid basis,
per-process basis, or whatever.

Other than the pagecache stats you mention, there is a 
general lack of numbers in the MM code.

I think that SystemTap suits the requirement for creation
of detailed MM statistics, allowing creation of hooks outside the 
kernel in an easy manner. Hooks can be inserted on demand.

I just started playing with SystemTap yesterday. First
thing I want to record is "what is the latency of 
direct reclaim".


WARNING: multiple messages have this Message-ID (diff)
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: Badari Pulavarty <pbadari@us.ibm.com>
Cc: linux-mm <linux-mm@kvack.org>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: Better pagecache statistics ?
Date: Thu, 1 Dec 2005 13:20:29 -0200	[thread overview]
Message-ID: <20051201152029.GA14499@dmt.cnet> (raw)
In-Reply-To: <1133377029.27824.90.camel@localhost.localdomain>

Hi Badari,

On Wed, Nov 30, 2005 at 10:57:09AM -0800, Badari Pulavarty wrote:
> Hi,
> 
> Is there a effort/patches underway to provide better pagecache
> statistics ? 
> 
> Basically, I am interested in finding detailed break out of
> cached pages. ("Cached" in /proc/meminfo) 
> 
> Out of this "cached pages"
> 
> - How much is just file system cache (regular file data) ?
> - How much is shared memory pages ?

You could do that from userspace probably, by doing some math 
on all processes statistics versus global stats, but does not 
seem very practical.

> - How much is mmaped() stuff ?

That would be "nr_mapped".

> - How much is for text, data, bss, heap, malloc ?

Hum, the core pagecache code does not deal with such details, 
so adding (and maintaining) accounting there does not seem very 
practical either.

You could walk /proc/<pid>/{maps,smaps} and account for different
types of pages.

$ cat /proc/self/smaps

bf8df000-bf8f4000 rw-p bf8df000 00:00 0          [stack]
Size:                84 kB
Rss:                  8 kB
Shared_Clean:         0 kB
Shared_Dirty:         0 kB
Private_Clean:        0 kB
Private_Dirty:        8 kB

0975b000-0977c000 rw-p 0975b000 00:00 0          [heap]
Size:               132 kB
Rss:                  4 kB
Shared_Clean:         0 kB
Shared_Dirty:         4 kB
Private_Clean:        0 kB
Private_Dirty:        0 kB 

But doing it from userspace does not guarantee much precision
since the state can change while walking the proc stats.

> What is the right way of getting this kind of data ? 
> I was trying to add tags when we do add_to_page_cache()
> and quickly got ugly :(

Problem is that any kind of information maybe be valuable,
depending on what you're trying to do.

For example, one might want to break statistics in /proc/vmstat
and /proc/meminfo on a per-zone basis (for instance there is no 
per-zone "locked" accounting at the moment), per-uid basis,
per-process basis, or whatever.

Other than the pagecache stats you mention, there is a 
general lack of numbers in the MM code.

I think that SystemTap suits the requirement for creation
of detailed MM statistics, allowing creation of hooks outside the 
kernel in an easy manner. Hooks can be inserted on demand.

I just started playing with SystemTap yesterday. First
thing I want to record is "what is the latency of 
direct reclaim".

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2005-12-01 15:20 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-30 18:57 Better pagecache statistics ? Badari Pulavarty
2005-11-30 18:57 ` Badari Pulavarty
2005-12-01  2:35 ` Hareesh Nagarajan
2005-12-01  2:35   ` Hareesh Nagarajan
2005-12-01 15:20 ` Marcelo Tosatti [this message]
2005-12-01 15:20   ` Marcelo Tosatti
2005-12-01 15:59   ` Badari Pulavarty
2005-12-01 15:59     ` Badari Pulavarty
2005-12-01 16:10     ` Arjan van de Ven
2005-12-01 16:10       ` Arjan van de Ven
2005-12-01 16:23       ` Badari Pulavarty
2005-12-01 16:23         ` Badari Pulavarty
2005-12-01 17:08       ` Marcelo Tosatti
2005-12-01 17:08         ` Marcelo Tosatti
2005-12-01 17:15         ` Badari Pulavarty
2005-12-01 17:15           ` Badari Pulavarty
2005-12-01 17:21           ` Arjan van de Ven
2005-12-01 17:21             ` Arjan van de Ven
2005-12-01 17:57             ` Marcelo Tosatti
2005-12-01 17:57               ` Marcelo Tosatti
2005-12-01 18:20               ` Badari Pulavarty
2005-12-01 18:20                 ` Badari Pulavarty
2005-12-02 22:15                 ` Frank Ch. Eigler
2005-12-02 22:15                   ` Frank Ch. Eigler
2005-12-02 22:31                   ` Badari Pulavarty
2005-12-02 22:31                     ` Badari Pulavarty
2005-12-02 22:46                     ` Frank Ch. Eigler
2005-12-02 22:46                       ` Frank Ch. Eigler
2005-12-02 23:46                       ` Badari Pulavarty
2005-12-01 18:24               ` Badari Pulavarty
2005-12-01 18:24                 ` Badari Pulavarty
2005-12-04 18:48           ` Martin J. Bligh
2005-12-04 18:48             ` Martin J. Bligh
2005-12-01 17:19     ` Marcelo Tosatti
2005-12-01 17:19       ` Marcelo Tosatti
2005-12-01 17:31       ` Badari Pulavarty
2005-12-01 17:31         ` Badari Pulavarty
2005-12-01 18:15         ` Marcelo Tosatti
2005-12-01 18:15           ` Marcelo Tosatti
2005-12-01 18:25           ` Badari Pulavarty
2005-12-01 18:25             ` Badari Pulavarty
2005-12-01 16:00   ` Marcelo Tosatti
2005-12-01 16:00     ` Marcelo Tosatti
2005-12-01 21:16     ` Christoph Lameter
2005-12-01 21:16       ` Christoph Lameter
2005-12-02  0:13       ` Badari Pulavarty
2005-12-02  0:13         ` Badari Pulavarty
2005-12-28  1:33   ` Marcelo Tosatti
2005-12-28  1:33     ` Marcelo Tosatti
2005-12-28 19:36     ` Tom Zanussi
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=20051201152029.GA14499@dmt.cnet \
    --to=marcelo.tosatti@cyclades.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pbadari@us.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.