diff options
-rw-r--r-- | Documentation/filesystems/proc.txt | 13 | ||||
-rw-r--r-- | fs/proc/task_mmu.c | 6 |
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 | |||
370 | Private_Clean: 0 kB | 370 | Private_Clean: 0 kB |
371 | Private_Dirty: 0 kB | 371 | Private_Dirty: 0 kB |
372 | Referenced: 892 kB | 372 | Referenced: 892 kB |
373 | Anonymous: 0 kB | ||
373 | Swap: 0 kB | 374 | Swap: 0 kB |
374 | KernelPageSize: 4 kB | 375 | KernelPageSize: 4 kB |
375 | MMUPageSize: 4 kB | 376 | MMUPageSize: 4 kB |
@@ -378,9 +379,15 @@ The first of these lines shows the same information as is displayed for the | |||
378 | mapping in /proc/PID/maps. The remaining lines show the size of the mapping | 379 | mapping 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 |
380 | process' proportional share of this mapping (PSS), the number of clean and | 381 | process' proportional share of this mapping (PSS), the number of clean and |
381 | dirty shared pages in the mapping, and the number of clean and dirty private | 382 | dirty private pages in the mapping. Note that even a page which is part of a |
382 | pages in the mapping. The "Referenced" indicates the amount of memory | 383 | MAP_SHARED mapping, but has only a single pte mapped, i.e. is currently used |
383 | currently marked as referenced or accessed. | 384 | by only one process, is accounted as private and not as shared. "Referenced" |
385 | indicates 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 | ||
387 | a mapping associated with a file may contain anonymous pages: when MAP_PRIVATE | ||
388 | and 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 | ||
390 | swap. | ||
384 | 391 | ||
385 | This file is only present if the CONFIG_MMU kernel configuration option is | 392 | This file is only present if the CONFIG_MMU kernel configuration option is |
386 | enabled. | 393 | enabled. |
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); |