diff options
author | Peter Zijlstra <peterz@infradead.org> | 2008-04-28 05:12:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 11:58:22 -0400 |
commit | 214e471ff99064726b2d8af3aa0e24a73c775531 (patch) | |
tree | a78674e56c27db43490cac0ef7c121e845051b62 /fs | |
parent | e20b8cca760ed2a6abcfe37ef56f2306790db648 (diff) |
smaps: account swap entries
Show the amount of swap for each vma. This can be used to see where all the
swap goes.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Matt Mackall <mpm@selenic.com>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/task_mmu.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index f4ab76c7c662..7415eeb7cc3a 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -338,8 +338,7 @@ const struct file_operations proc_maps_operations = { | |||
338 | #define PSS_SHIFT 12 | 338 | #define PSS_SHIFT 12 |
339 | 339 | ||
340 | #ifdef CONFIG_PROC_PAGE_MONITOR | 340 | #ifdef CONFIG_PROC_PAGE_MONITOR |
341 | struct mem_size_stats | 341 | struct mem_size_stats { |
342 | { | ||
343 | struct vm_area_struct *vma; | 342 | struct vm_area_struct *vma; |
344 | unsigned long resident; | 343 | unsigned long resident; |
345 | unsigned long shared_clean; | 344 | unsigned long shared_clean; |
@@ -347,6 +346,7 @@ struct mem_size_stats | |||
347 | unsigned long private_clean; | 346 | unsigned long private_clean; |
348 | unsigned long private_dirty; | 347 | unsigned long private_dirty; |
349 | unsigned long referenced; | 348 | unsigned long referenced; |
349 | unsigned long swap; | ||
350 | u64 pss; | 350 | u64 pss; |
351 | }; | 351 | }; |
352 | 352 | ||
@@ -363,6 +363,12 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, | |||
363 | pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); | 363 | pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); |
364 | for (; addr != end; pte++, addr += PAGE_SIZE) { | 364 | for (; addr != end; pte++, addr += PAGE_SIZE) { |
365 | ptent = *pte; | 365 | ptent = *pte; |
366 | |||
367 | if (is_swap_pte(ptent)) { | ||
368 | mss->swap += PAGE_SIZE; | ||
369 | continue; | ||
370 | } | ||
371 | |||
366 | if (!pte_present(ptent)) | 372 | if (!pte_present(ptent)) |
367 | continue; | 373 | continue; |
368 | 374 | ||
@@ -421,7 +427,8 @@ static int show_smap(struct seq_file *m, void *v) | |||
421 | "Shared_Dirty: %8lu kB\n" | 427 | "Shared_Dirty: %8lu kB\n" |
422 | "Private_Clean: %8lu kB\n" | 428 | "Private_Clean: %8lu kB\n" |
423 | "Private_Dirty: %8lu kB\n" | 429 | "Private_Dirty: %8lu kB\n" |
424 | "Referenced: %8lu kB\n", | 430 | "Referenced: %8lu kB\n" |
431 | "Swap: %8lu kB\n", | ||
425 | (vma->vm_end - vma->vm_start) >> 10, | 432 | (vma->vm_end - vma->vm_start) >> 10, |
426 | mss.resident >> 10, | 433 | mss.resident >> 10, |
427 | (unsigned long)(mss.pss >> (10 + PSS_SHIFT)), | 434 | (unsigned long)(mss.pss >> (10 + PSS_SHIFT)), |
@@ -429,7 +436,8 @@ static int show_smap(struct seq_file *m, void *v) | |||
429 | mss.shared_dirty >> 10, | 436 | mss.shared_dirty >> 10, |
430 | mss.private_clean >> 10, | 437 | mss.private_clean >> 10, |
431 | mss.private_dirty >> 10, | 438 | mss.private_dirty >> 10, |
432 | mss.referenced >> 10); | 439 | mss.referenced >> 10, |
440 | mss.swap >> 10); | ||
433 | 441 | ||
434 | return ret; | 442 | return ret; |
435 | } | 443 | } |