public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxim Levitsky <maximlevitsky@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [RFC] [PATCH] Add more info to /proc/$pid/smaps
Date: Fri, 5 Oct 2007 12:42:41 +0200	[thread overview]
Message-ID: <200710051242.41867.maximlevitsky@gmail.com> (raw)

I was trying to write a small application similar to pmap, but more powerful.
During the writing I noticed that there are two things I can't get by parsing /proc/$pid/smaps:

1) amount of anonymous memory in a mapping:

It is easy to get it for shared and anonymous mappings (0 for the former, and whole mapping for the latter)
But it is impossible to get it for private writable file mappings.

It seems that the dirty (Private_Dirty+Shared_Dirty) pages amount should indicate number of anonymous pages in the mapping
but this is not the case.

If a dirty page gets swapped, and then brought back due to read access, it will be marked clean, although it is an anonymous page.

2) amount of swapped memory in a mapping:

Again it seems that I can do (Mapping size - RSS) to get amount of memory swapped, but this isn't true too, since
some memory can be untouched , thus be non-present, and non-swapped.


The patch below adds two fields to /proc/$pid/smaps, that give this information.

Probably even more info will be interesting.
How about adding amount of locked memory, and most importantly map count?
This way I can estimate how 'shared' a process memory really is.

Suggestions are welcome.

Best regards,
	Maxim Levitsky

             reply	other threads:[~2007-10-05 10:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-05 10:42 Maxim Levitsky [this message]
2007-10-05 10:43 ` [RFC] [PATCH] Add more info to /proc/$pid/smaps Maxim Levitsky

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=200710051242.41867.maximlevitsky@gmail.com \
    --to=maximlevitsky@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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