aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/proc.txt13
-rw-r--r--fs/proc/task_mmu.c6
2 files changed, 16 insertions, 3 deletions
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index a563b74c7aef..976de6e19dd8 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -370,6 +370,7 @@ Shared_Dirty: 0 kB
370Private_Clean: 0 kB 370Private_Clean: 0 kB
371Private_Dirty: 0 kB 371Private_Dirty: 0 kB
372Referenced: 892 kB 372Referenced: 892 kB
373Anonymous: 0 kB
373Swap: 0 kB 374Swap: 0 kB
374KernelPageSize: 4 kB 375KernelPageSize: 4 kB
375MMUPageSize: 4 kB 376MMUPageSize: 4 kB
@@ -378,9 +379,15 @@ The first of these lines shows the same information as is displayed for the
378mapping in /proc/PID/maps. The remaining lines show the size of the mapping 379mapping in /proc/PID/maps. The remaining lines show the size of the mapping
379(size), the amount of the mapping that is currently resident in RAM (RSS), the 380(size), the amount of the mapping that is currently resident in RAM (RSS), the
380process' proportional share of this mapping (PSS), the number of clean and 381process' proportional share of this mapping (PSS), the number of clean and
381dirty shared pages in the mapping, and the number of clean and dirty private 382dirty private pages in the mapping. Note that even a page which is part of a
382pages in the mapping. The "Referenced" indicates the amount of memory 383MAP_SHARED mapping, but has only a single pte mapped, i.e. is currently used
383currently marked as referenced or accessed. 384by only one process, is accounted as private and not as shared. "Referenced"
385indicates the amount of memory currently marked as referenced or accessed.
386"Anonymous" shows the amount of memory that does not belong to any file. Even
387a mapping associated with a file may contain anonymous pages: when MAP_PRIVATE
388and a page is modified, the file page is replaced by a private anonymous copy.
389"Swap" shows how much would-be-anonymous memory is also used, but out on
390swap.
384 391
385This file is only present if the CONFIG_MMU kernel configuration option is 392This file is only present if the CONFIG_MMU kernel configuration option is
386enabled. 393enabled.
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 871e25ed0069..da6b01d70f01 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -327,6 +327,7 @@ struct mem_size_stats {
327 unsigned long private_clean; 327 unsigned long private_clean;
328 unsigned long private_dirty; 328 unsigned long private_dirty;
329 unsigned long referenced; 329 unsigned long referenced;
330 unsigned long anonymous;
330 unsigned long swap; 331 unsigned long swap;
331 u64 pss; 332 u64 pss;
332}; 333};
@@ -357,6 +358,9 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
357 if (!page) 358 if (!page)
358 continue; 359 continue;
359 360
361 if (PageAnon(page))
362 mss->anonymous += PAGE_SIZE;
363
360 mss->resident += PAGE_SIZE; 364 mss->resident += PAGE_SIZE;
361 /* Accumulate the size in pages that have been accessed. */ 365 /* Accumulate the size in pages that have been accessed. */
362 if (pte_young(ptent) || PageReferenced(page)) 366 if (pte_young(ptent) || PageReferenced(page))
@@ -410,6 +414,7 @@ static int show_smap(struct seq_file *m, void *v)
410 "Private_Clean: %8lu kB\n" 414 "Private_Clean: %8lu kB\n"
411 "Private_Dirty: %8lu kB\n" 415 "Private_Dirty: %8lu kB\n"
412 "Referenced: %8lu kB\n" 416 "Referenced: %8lu kB\n"
417 "Anonymous: %8lu kB\n"
413 "Swap: %8lu kB\n" 418 "Swap: %8lu kB\n"
414 "KernelPageSize: %8lu kB\n" 419 "KernelPageSize: %8lu kB\n"
415 "MMUPageSize: %8lu kB\n", 420 "MMUPageSize: %8lu kB\n",
@@ -421,6 +426,7 @@ static int show_smap(struct seq_file *m, void *v)
421 mss.private_clean >> 10, 426 mss.private_clean >> 10,
422 mss.private_dirty >> 10, 427 mss.private_dirty >> 10,
423 mss.referenced >> 10, 428 mss.referenced >> 10,
429 mss.anonymous >> 10,
424 mss.swap >> 10, 430 mss.swap >> 10,
425 vma_kernel_pagesize(vma) >> 10, 431 vma_kernel_pagesize(vma) >> 10,
426 vma_mmu_pagesize(vma) >> 10); 432 vma_mmu_pagesize(vma) >> 10);