* [PATCH 2/5] pagemap: Change kpagecount to return the map count, not the reference count, of a page.
@ 2008-06-05 15:04 Thomas Tuttle
2008-06-05 16:01 ` Matt Mackall
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Tuttle @ 2008-06-05 15:04 UTC (permalink / raw)
To: mpm, akpm, linux-kernel
[-- 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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 2/5] pagemap: Change kpagecount to return the map count, not the reference count, of a page.
2008-06-05 15:04 [PATCH 2/5] pagemap: Change kpagecount to return the map count, not the reference count, of a page Thomas Tuttle
@ 2008-06-05 16:01 ` Matt Mackall
2008-06-05 16:03 ` Thomas Tuttle
0 siblings, 1 reply; 3+ messages in thread
From: Matt Mackall @ 2008-06-05 16:01 UTC (permalink / raw)
To: Thomas Tuttle; +Cc: akpm, linux-kernel
On Thu, 2008-06-05 at 11:04 -0400, Thomas Tuttle wrote:
> 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.
I'm pretty sure this has been suggested before and I was just too
thick-skulled to get it. Yes, the reference count is less useful.
Acked-by: Matt Mackall <mpm@selenic.com>
ps: It's much prefered to send patches inline.
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/5] pagemap: Change kpagecount to return the map count, not the reference count, of a page.
2008-06-05 16:01 ` Matt Mackall
@ 2008-06-05 16:03 ` Thomas Tuttle
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Tuttle @ 2008-06-05 16:03 UTC (permalink / raw)
To: Matt Mackall; +Cc: akpm, linux-kernel
On Thu, Jun 5, 2008 at 12:01 PM, Matt Mackall <mpm@selenic.com> wrote:
>
> On Thu, 2008-06-05 at 11:04 -0400, Thomas Tuttle wrote:
>> 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.
>
> I'm pretty sure this has been suggested before and I was just too
> thick-skulled to get it. Yes, the reference count is less useful.
>
> Acked-by: Matt Mackall <mpm@selenic.com>
>
> ps: It's much prefered to send patches inline.
Oh. Sorry about that. (It's been a while since I sent patches to LKML.)
--ttuttle
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-06-05 16:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-05 15:04 [PATCH 2/5] pagemap: Change kpagecount to return the map count, not the reference count, of a page Thomas Tuttle
2008-06-05 16:01 ` Matt Mackall
2008-06-05 16:03 ` Thomas Tuttle
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®