提交 214e471f 编写于 作者: P Peter Zijlstra 提交者: Linus Torvalds

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: NPeter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: NMatt Mackall <mpm@selenic.com>
Acked-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 e20b8cca
...@@ -338,8 +338,7 @@ const struct file_operations proc_maps_operations = { ...@@ -338,8 +338,7 @@ const struct file_operations proc_maps_operations = {
#define PSS_SHIFT 12 #define PSS_SHIFT 12
#ifdef CONFIG_PROC_PAGE_MONITOR #ifdef CONFIG_PROC_PAGE_MONITOR
struct mem_size_stats struct mem_size_stats {
{
struct vm_area_struct *vma; struct vm_area_struct *vma;
unsigned long resident; unsigned long resident;
unsigned long shared_clean; unsigned long shared_clean;
...@@ -347,6 +346,7 @@ struct mem_size_stats ...@@ -347,6 +346,7 @@ struct mem_size_stats
unsigned long private_clean; unsigned long private_clean;
unsigned long private_dirty; unsigned long private_dirty;
unsigned long referenced; unsigned long referenced;
unsigned long swap;
u64 pss; u64 pss;
}; };
...@@ -363,6 +363,12 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, ...@@ -363,6 +363,12 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
for (; addr != end; pte++, addr += PAGE_SIZE) { for (; addr != end; pte++, addr += PAGE_SIZE) {
ptent = *pte; ptent = *pte;
if (is_swap_pte(ptent)) {
mss->swap += PAGE_SIZE;
continue;
}
if (!pte_present(ptent)) if (!pte_present(ptent))
continue; continue;
...@@ -421,7 +427,8 @@ static int show_smap(struct seq_file *m, void *v) ...@@ -421,7 +427,8 @@ static int show_smap(struct seq_file *m, void *v)
"Shared_Dirty: %8lu kB\n" "Shared_Dirty: %8lu kB\n"
"Private_Clean: %8lu kB\n" "Private_Clean: %8lu kB\n"
"Private_Dirty: %8lu kB\n" "Private_Dirty: %8lu kB\n"
"Referenced: %8lu kB\n", "Referenced: %8lu kB\n"
"Swap: %8lu kB\n",
(vma->vm_end - vma->vm_start) >> 10, (vma->vm_end - vma->vm_start) >> 10,
mss.resident >> 10, mss.resident >> 10,
(unsigned long)(mss.pss >> (10 + PSS_SHIFT)), (unsigned long)(mss.pss >> (10 + PSS_SHIFT)),
...@@ -429,7 +436,8 @@ static int show_smap(struct seq_file *m, void *v) ...@@ -429,7 +436,8 @@ static int show_smap(struct seq_file *m, void *v)
mss.shared_dirty >> 10, mss.shared_dirty >> 10,
mss.private_clean >> 10, mss.private_clean >> 10,
mss.private_dirty >> 10, mss.private_dirty >> 10,
mss.referenced >> 10); mss.referenced >> 10,
mss.swap >> 10);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册