From: "Thomas Tuttle" <ttuttle@google.com>
To: mpm@selenic.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/5] pagemap: Change kpagecount to return the map count, not the reference count, of a page.
Date: Thu, 5 Jun 2008 11:04:33 -0400 [thread overview]
Message-ID: <4ca0a85e0806050804s798bba46wcb29d2582120bfab@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 552 bytes --]
When trying to use pagemap to calculate the "proportional set size"
[1] of a process, I discovered that there were often references to
pages that could not be discovered by kpagecount. I changed
kpagecount to return the number of times a page is mapped, rather than
referenced, so kpagecount is more useful for determining how many
processes are using a page.
[1] PSS is the amount of memory used by a process, weighted by 1 / the
number of processes sharing the memory -- so a 128K library shared by
2 processes counts as 64K PSS for each of them.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-Changed-kpagecount-to-return-the-map-count-not-the.patch --]
[-- Type: text/x-patch; name=0002-Changed-kpagecount-to-return-the-map-count-not-the.patch, Size: 885 bytes --]
From ff2e2842b7662322068e5602afc82d5ad2ee827f Mon Sep 17 00:00:00 2001
From: Thomas Tuttle <ttuttle@google.com>
Date: Thu, 5 Jun 2008 09:39:12 -0400
Subject: [PATCH] Changed kpagecount to return the map count, not the reference count, of a page.
This ensures that, if you read the pagemap of every process, and tally the
number of references to a page, it matches what is in kpagecount.
---
fs/proc/proc_misc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 32dc14c..5a16090 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -726,7 +726,7 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf,
if (!ppage)
pcount = 0;
else
- pcount = atomic_read(&ppage->_count);
+ pcount = page_mapcount(ppage);
if (put_user(pcount, out++)) {
ret = -EFAULT;
--
1.5.3.6
next reply other threads:[~2008-06-05 15:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-05 15:04 Thomas Tuttle [this message]
2008-06-05 16:01 ` Matt Mackall
2008-06-05 16:03 ` Thomas Tuttle
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=4ca0a85e0806050804s798bba46wcb29d2582120bfab@mail.gmail.com \
--to=ttuttle@google.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.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
all inboxes | Powered by JetHome®