diff options
author | Ying Han <yinghan@google.com> | 2011-05-26 19:25:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-26 20:12:36 -0400 |
commit | 456f998ec817ebfa254464be4f089542fa390645 (patch) | |
tree | 5976aa500638f0bbade1a672233cad71765b89b8 /fs/ncpfs | |
parent | 406eb0c9ba765eb066406fd5ce9d5e2b169a4d5a (diff) |
memcg: add the pagefault count into memcg stats
Two new stats in per-memcg memory.stat which tracks the number of page
faults and number of major page faults.
"pgfault"
"pgmajfault"
They are different from "pgpgin"/"pgpgout" stat which count number of
pages charged/discharged to the cgroup and have no meaning of reading/
writing page to disk.
It is valuable to track the two stats for both measuring application's
performance as well as the efficiency of the kernel page reclaim path.
Counting pagefaults per process is useful, but we also need the aggregated
value since processes are monitored and controlled in cgroup basis in
memcg.
Functional test: check the total number of pgfault/pgmajfault of all
memcgs and compare with global vmstat value:
$ cat /proc/vmstat | grep fault
pgfault 1070751
pgmajfault 553
$ cat /dev/cgroup/memory.stat | grep fault
pgfault 1071138
pgmajfault 553
total_pgfault 1071142
total_pgmajfault 553
$ cat /dev/cgroup/A/memory.stat | grep fault
pgfault 199
pgmajfault 0
total_pgfault 199
total_pgmajfault 0
Performance test: run page fault test(pft) wit 16 thread on faulting in
15G anon pages in 16G container. There is no regression noticed on the
"flt/cpu/s"
Sample output from pft:
TAG pft:anon-sys-default:
Gb Thr CLine User System Wall flt/cpu/s fault/wsec
15 16 1 0.67s 233.41s 14.76s 16798.546 266356.260
+-------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 10 16682.962 17344.027 16913.524 16928.812 166.5362
+ 10 16695.568 16923.896 16820.604 16824.652 84.816568
No difference proven at 95.0% confidence
[akpm@linux-foundation.org: fix build]
[hughd@google.com: shmem fix]
Signed-off-by: Ying Han <yinghan@google.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ncpfs')
-rw-r--r-- | fs/ncpfs/mmap.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ncpfs/mmap.c b/fs/ncpfs/mmap.c index a7c07b44b100..e5d71b27a5b0 100644 --- a/fs/ncpfs/mmap.c +++ b/fs/ncpfs/mmap.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/mman.h> | 16 | #include <linux/mman.h> |
17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
18 | #include <linux/fcntl.h> | 18 | #include <linux/fcntl.h> |
19 | #include <linux/memcontrol.h> | ||
19 | 20 | ||
20 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
21 | #include <asm/system.h> | 22 | #include <asm/system.h> |
@@ -92,6 +93,7 @@ static int ncp_file_mmap_fault(struct vm_area_struct *area, | |||
92 | * -- wli | 93 | * -- wli |
93 | */ | 94 | */ |
94 | count_vm_event(PGMAJFAULT); | 95 | count_vm_event(PGMAJFAULT); |
96 | mem_cgroup_count_vm_event(area->vm_mm, PGMAJFAULT); | ||
95 | return VM_FAULT_MAJOR; | 97 | return VM_FAULT_MAJOR; |
96 | } | 98 | } |
97 | 99 | ||