aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems
diff options
context:
space:
mode:
authorMinchan Kim <minchan@kernel.org>2015-09-08 18:00:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-08 18:35:28 -0400
commit8334b96221ff0dcbde4873d31eb4d84774ed8ed4 (patch)
tree35c6f7a7ab427834a10c3e74ccedcac9911e588a /Documentation/filesystems
parent3115aec4513e5bcb399235cac98a5637fe641c13 (diff)
mm: /proc/pid/smaps:: show proportional swap share of the mapping
We want to know per-process workingset size for smart memory management on userland and we use swap(ex, zram) heavily to maximize memory efficiency so workingset includes swap as well as RSS. On such system, if there are lots of shared anonymous pages, it's really hard to figure out exactly how many each process consumes memory(ie, rss + wap) if the system has lots of shared anonymous memory(e.g, android). This patch introduces SwapPss field on /proc/<pid>/smaps so we can get more exact workingset size per process. Bongkyu tested it. Result is below. 1. 50M used swap SwapTotal: 461976 kB SwapFree: 411192 kB $ adb shell cat /proc/*/smaps | grep "SwapPss:" | awk '{sum += $2} END {print sum}'; 48236 $ adb shell cat /proc/*/smaps | grep "Swap:" | awk '{sum += $2} END {print sum}'; 141184 2. 240M used swap SwapTotal: 461976 kB SwapFree: 216808 kB $ adb shell cat /proc/*/smaps | grep "SwapPss:" | awk '{sum += $2} END {print sum}'; 230315 $ adb shell cat /proc/*/smaps | grep "Swap:" | awk '{sum += $2} END {print sum}'; 1387744 [akpm@linux-foundation.org: simplify kunmap_atomic() call] Signed-off-by: Minchan Kim <minchan@kernel.org> Reported-by: Bongkyu Kim <bongkyu.kim@lge.com> Tested-by: Bongkyu Kim <bongkyu.kim@lge.com> Cc: Hugh Dickins <hughd@google.com> Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Jerome Marchand <jmarchan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/filesystems')
-rw-r--r--Documentation/filesystems/proc.txt18
1 files changed, 13 insertions, 5 deletions
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index 6f7fafde0884..d411ca63c8b6 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -424,6 +424,7 @@ Private_Dirty: 0 kB
424Referenced: 892 kB 424Referenced: 892 kB
425Anonymous: 0 kB 425Anonymous: 0 kB
426Swap: 0 kB 426Swap: 0 kB
427SwapPss: 0 kB
427KernelPageSize: 4 kB 428KernelPageSize: 4 kB
428MMUPageSize: 4 kB 429MMUPageSize: 4 kB
429Locked: 374 kB 430Locked: 374 kB
@@ -433,16 +434,23 @@ the first of these lines shows the same information as is displayed for the
433mapping in /proc/PID/maps. The remaining lines show the size of the mapping 434mapping in /proc/PID/maps. The remaining lines show the size of the mapping
434(size), the amount of the mapping that is currently resident in RAM (RSS), the 435(size), the amount of the mapping that is currently resident in RAM (RSS), the
435process' proportional share of this mapping (PSS), the number of clean and 436process' proportional share of this mapping (PSS), the number of clean and
436dirty private pages in the mapping. Note that even a page which is part of a 437dirty private pages in the mapping.
437MAP_SHARED mapping, but has only a single pte mapped, i.e. is currently used 438
438by only one process, is accounted as private and not as shared. "Referenced" 439The "proportional set size" (PSS) of a process is the count of pages it has
439indicates the amount of memory currently marked as referenced or accessed. 440in memory, where each page is divided by the number of processes sharing it.
441So if a process has 1000 pages all to itself, and 1000 shared with one other
442process, its PSS will be 1500.
443Note that even a page which is part of a MAP_SHARED mapping, but has only
444a single pte mapped, i.e. is currently used by only one process, is accounted
445as private and not as shared.
446"Referenced" indicates the amount of memory currently marked as referenced or
447accessed.
440"Anonymous" shows the amount of memory that does not belong to any file. Even 448"Anonymous" shows the amount of memory that does not belong to any file. Even
441a mapping associated with a file may contain anonymous pages: when MAP_PRIVATE 449a mapping associated with a file may contain anonymous pages: when MAP_PRIVATE
442and a page is modified, the file page is replaced by a private anonymous copy. 450and a page is modified, the file page is replaced by a private anonymous copy.
443"Swap" shows how much would-be-anonymous memory is also used, but out on 451"Swap" shows how much would-be-anonymous memory is also used, but out on
444swap. 452swap.
445 453"SwapPss" shows proportional swap share of this mapping.
446"VmFlags" field deserves a separate description. This member represents the kernel 454"VmFlags" field deserves a separate description. This member represents the kernel
447flags associated with the particular virtual memory area in two letter encoded 455flags associated with the particular virtual memory area in two letter encoded
448manner. The codes are the following: 456manner. The codes are the following: