Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1463966 > unrolled thread
| Started by | robert.foss@collabora.com |
|---|---|
| First post | 2016-08-16 19:40 +0200 |
| Last post | 2016-08-16 20:30 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
[PACTH v3 0/3] Implement /proc/<pid>/totmaps robert.foss@collabora.com - 2016-08-16 19:40 +0200
[PACTH v3 3/3] Documentation/filesystems: Added /proc/PID/totmaps documentation robert.foss@collabora.com - 2016-08-16 19:40 +0200
Re: [PACTH v3 3/3] Documentation/filesystems: Added /proc/PID/totmaps documentation Jann Horn <jann@thejh.net> - 2016-08-16 20:10 +0200
Re: [PACTH v3 3/3] Documentation/filesystems: Added /proc/PID/totmaps documentation Robert Foss <robert.foss@collabora.com> - 2016-08-16 20:30 +0200
| From | robert.foss@collabora.com |
|---|---|
| Date | 2016-08-16 19:40 +0200 |
| Subject | [PACTH v3 0/3] Implement /proc/<pid>/totmaps |
| Message-ID | <s6Qvg-61D-17@gated-at.bofh.it> |
From: Robert Foss <robert.foss@collabora.com>
This series provides the /proc/PID/totmaps feature, which
summarizes the information provided by /proc/PID/smaps for
improved performance and usability reasons.
A use case is to speed up monitoring of memory consumption in
environments where RSS isn't precise.
For example Chrome tends to many processes which have hundreds of VMAs
with a substantial amount of shared memory, and the error of using
RSS rather than PSS tends to be very large when looking at overall
memory consumption. PSS isn't kept as a single number that's exported
like RSS, so to calculate PSS means having to parse a very large smaps
file.
This process is slow and has to be repeated for many processes, and we
found that the just act of doing the parsing was taking up a
significant amount of CPU time, so this patch is an attempt to make
that process cheaper.
/proc/PID/totmaps provides roughly a 2x speedup compared to parsing
/proc/PID/smaps with awk.
$ /usr/bin/time -v -p zsh -c "(repeat 25 {cat /proc/5025/totmaps})"
[...]
Command being timed: "zsh -c (repeat 25 {cat /proc/5025/totmaps})"
User time (seconds): 0.00
System time (seconds): 0.40
Percent of CPU this job got: 90%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.45
$ /usr/bin/time -v -p zsh -c "repeat 25 { awk '/^Rss/{rss+=\$2} /^Pss/{pss+=\$2} END {printf \"rss:%d pss:%d\n\", rss, pss}\' /proc/5025/smaps}"
[...]
Command being timed: "zsh -c repeat 25 { awk '/^Rss/{rss+=$2}
/^Pss/{pss+=$2} END {printf "rss:%d pss:%d\n", rss, pss}\' /proc/5025/smaps }"
User time (seconds): 0.37
System time (seconds): 0.45
Percent of CPU this job got: 92%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.89
Robert Foss (3):
mm, proc: Implement /proc/<pid>/totmaps
Documentation/filesystems: Fixed typo
Documentation/filesystems: Added /proc/PID/totmaps documentation
Documentation/filesystems/proc.txt | 23 ++++++-
fs/proc/base.c | 1 +
fs/proc/internal.h | 2 +
fs/proc/task_mmu.c | 129 +++++++++++++++++++++++++++++++++++++
4 files changed, 154 insertions(+), 1 deletion(-)
--
2.7.4
[toc] | [next] | [standalone]
| From | robert.foss@collabora.com |
|---|---|
| Date | 2016-08-16 19:40 +0200 |
| Subject | [PACTH v3 3/3] Documentation/filesystems: Added /proc/PID/totmaps documentation |
| Message-ID | <s6Qvg-61D-31@gated-at.bofh.it> |
| In reply to | #1463966 |
From: Robert Foss <robert.foss@collabora.com> Added documentation covering /proc/PID/totmaps. Signed-off-by: Robert Foss <robert.foss@collabora.com> --- Documentation/filesystems/proc.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 7d001be..c06ff33 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt @@ -11,6 +11,7 @@ Version 1.3 Kernel version 2.2.12 Kernel version 2.4.0-test11-pre4 ------------------------------------------------------------------------------ fixes/update part 1.1 Stefani Seibold <stefani@seibold.net> June 9 2009 +add totmaps Robert Foss <robert.foss@collabora.com> August 12 2016 Table of Contents ----------------- @@ -147,6 +148,8 @@ Table 1-1: Process specific entries in /proc stack Report full stack trace, enable via CONFIG_STACKTRACE smaps an extension based on maps, showing the memory consumption of each mapping and flags associated with it + totmaps an extenssion based on maps, showing the total memory + consumption of all mappings numa_maps an extension based on maps, showing the memory locality and binding policy as well as mem usage (in pages) of each mapping. .............................................................................. @@ -512,6 +515,24 @@ be vanished or the reverse -- new added. This file is only present if the CONFIG_MMU kernel configuration option is enabled. +The /proc/PID/totmaps is an extension based on maps, showing the memory +consumption totals for all of the process's mappings. It lists the sums of the +same statistics as /proc/PID/smaps. + +The process' mappings will be summarized as a series of lines like the +following: + +Rss: 4256 kB +Pss: 1170 kB +Shared_Clean: 2720 kB +Shared_Dirty: 1136 kB +Private_Clean: 0 kB +Private_Dirty: 400 kB +Referenced: 4256 kB +Anonymous: 1536 kB +AnonHugePages: 0 kB +Swap: 0 kB + The /proc/PID/clear_refs is used to reset the PG_Referenced and ACCESSED/YOUNG bits on both physical and virtual pages associated with a process, and the soft-dirty bit on pte (see Documentation/vm/soft-dirty.txt for details). -- 2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Jann Horn <jann@thejh.net> |
|---|---|
| Date | 2016-08-16 20:10 +0200 |
| Subject | Re: [PACTH v3 3/3] Documentation/filesystems: Added /proc/PID/totmaps documentation |
| Message-ID | <s6QYh-6qv-15@gated-at.bofh.it> |
| In reply to | #1463967 |
[Multipart message — attachments visible in raw view] — view raw
On Tue, Aug 16, 2016 at 01:34:16PM -0400, robert.foss@collabora.com wrote: > + totmaps an extenssion based on maps, showing the total memory > + consumption of all mappings nit: s/extenssion/extension/
[toc] | [prev] | [next] | [standalone]
| From | Robert Foss <robert.foss@collabora.com> |
|---|---|
| Date | 2016-08-16 20:30 +0200 |
| Subject | Re: [PACTH v3 3/3] Documentation/filesystems: Added /proc/PID/totmaps documentation |
| Message-ID | <s6RhD-6xt-1@gated-at.bofh.it> |
| In reply to | #1463982 |
On 2016-08-16 02:01 PM, Jann Horn wrote: > nit: s/extenssion/extension/ Thanks :)
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web