diff options
author | David Rientjes <rientjes@google.com> | 2007-05-06 17:49:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 15:12:52 -0400 |
commit | b813e931b4c8235bb42e301096ea97dbdee3e8fe (patch) | |
tree | f8182687bffe8e3b95bac69b2cc7fdfe674ddc53 /Documentation/filesystems/proc.txt | |
parent | f79f177c25016647cc92ffac8afa7cb96ce47011 (diff) |
smaps: add clear_refs file to clear reference
Adds /proc/pid/clear_refs. When any non-zero number is written to this file,
pte_mkold() and ClearPageReferenced() is called for each pte and its
corresponding page, respectively, in that task's VMAs. This file is only
writable by the user who owns the task.
It is now possible to measure _approximately_ how much memory a task is using
by clearing the reference bits with
echo 1 > /proc/pid/clear_refs
and checking the reference count for each VMA from the /proc/pid/smaps output
at a measured time interval. For example, to observe the approximate change
in memory footprint for a task, write a script that clears the references
(echo 1 > /proc/pid/clear_refs), sleeps, and then greps for Pgs_Referenced and
extracts the size in kB. Add the sizes for each VMA together for the total
referenced footprint. Moments later, repeat the process and observe the
difference.
For example, using an efficient Mozilla:
accumulated time referenced memory
---------------- -----------------
0 s 408 kB
1 s 408 kB
2 s 556 kB
3 s 1028 kB
4 s 872 kB
5 s 1956 kB
6 s 416 kB
7 s 1560 kB
8 s 2336 kB
9 s 1044 kB
10 s 416 kB
This is a valuable tool to get an approximate measurement of the memory
footprint for a task.
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Christoph Lameter <clameter@sgi.com>
Signed-off-by: David Rientjes <rientjes@google.com>
[akpm@linux-foundation.org: build fixes]
[mpm@selenic.com: rename for_each_pmd]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/filesystems/proc.txt')
-rw-r--r-- | Documentation/filesystems/proc.txt | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 7aaf09b86a55..3f4b226572e7 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -122,21 +122,22 @@ subdirectory has the entries listed in Table 1-1. | |||
122 | 122 | ||
123 | Table 1-1: Process specific entries in /proc | 123 | Table 1-1: Process specific entries in /proc |
124 | .............................................................................. | 124 | .............................................................................. |
125 | File Content | 125 | File Content |
126 | cmdline Command line arguments | 126 | clear_refs Clears page referenced bits shown in smaps output |
127 | cpu Current and last cpu in which it was executed (2.4)(smp) | 127 | cmdline Command line arguments |
128 | cwd Link to the current working directory | 128 | cpu Current and last cpu in which it was executed (2.4)(smp) |
129 | environ Values of environment variables | 129 | cwd Link to the current working directory |
130 | exe Link to the executable of this process | 130 | environ Values of environment variables |
131 | fd Directory, which contains all file descriptors | 131 | exe Link to the executable of this process |
132 | maps Memory maps to executables and library files (2.4) | 132 | fd Directory, which contains all file descriptors |
133 | mem Memory held by this process | 133 | maps Memory maps to executables and library files (2.4) |
134 | root Link to the root directory of this process | 134 | mem Memory held by this process |
135 | stat Process status | 135 | root Link to the root directory of this process |
136 | statm Process memory status information | 136 | stat Process status |
137 | status Process status in human readable form | 137 | statm Process memory status information |
138 | wchan If CONFIG_KALLSYMS is set, a pre-decoded wchan | 138 | status Process status in human readable form |
139 | smaps Extension based on maps, presenting the rss size for each mapped file | 139 | wchan If CONFIG_KALLSYMS is set, a pre-decoded wchan |
140 | smaps Extension based on maps, the rss size for each mapped file | ||
140 | .............................................................................. | 141 | .............................................................................. |
141 | 142 | ||
142 | For example, to get the status information of a process, all you have to do is | 143 | For example, to get the status information of a process, all you have to do is |