diff options
| author | Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> | 2011-03-23 19:42:25 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-23 22:46:25 -0400 |
| commit | f212ad7cf9c73f8a7fa160e223dcb3f074441a72 (patch) | |
| tree | 95789ef7ce662e86a3e4aded5dfb97c51dc7b0a0 /include/linux | |
| parent | af4a662144884a7dbb19acbef70878b3b955f928 (diff) | |
memcg: add memcg sanity checks at allocating and freeing pages
Add checks at allocating or freeing a page whether the page is used (iow,
charged) from the view point of memcg.
This check may be useful in debugging a problem and we did similar checks
before the commit 52d4b9ac(memcg: allocate all page_cgroup at boot).
This patch adds some overheads at allocating or freeing memory, so it's
enabled only when CONFIG_DEBUG_VM is enabled.
Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/memcontrol.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 5bb7be2628ca..5a5ce7055839 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
| @@ -151,6 +151,10 @@ u64 mem_cgroup_get_limit(struct mem_cgroup *mem); | |||
| 151 | void mem_cgroup_split_huge_fixup(struct page *head, struct page *tail); | 151 | void mem_cgroup_split_huge_fixup(struct page *head, struct page *tail); |
| 152 | #endif | 152 | #endif |
| 153 | 153 | ||
| 154 | #ifdef CONFIG_DEBUG_VM | ||
| 155 | bool mem_cgroup_bad_page_check(struct page *page); | ||
| 156 | void mem_cgroup_print_bad_page(struct page *page); | ||
| 157 | #endif | ||
| 154 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ | 158 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ |
| 155 | struct mem_cgroup; | 159 | struct mem_cgroup; |
| 156 | 160 | ||
| @@ -352,5 +356,18 @@ static inline void mem_cgroup_split_huge_fixup(struct page *head, | |||
| 352 | 356 | ||
| 353 | #endif /* CONFIG_CGROUP_MEM_CONT */ | 357 | #endif /* CONFIG_CGROUP_MEM_CONT */ |
| 354 | 358 | ||
| 359 | #if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM) | ||
| 360 | static inline bool | ||
| 361 | mem_cgroup_bad_page_check(struct page *page) | ||
| 362 | { | ||
| 363 | return false; | ||
| 364 | } | ||
| 365 | |||
| 366 | static inline void | ||
| 367 | mem_cgroup_print_bad_page(struct page *page) | ||
| 368 | { | ||
| 369 | } | ||
| 370 | #endif | ||
| 371 | |||
| 355 | #endif /* _LINUX_MEMCONTROL_H */ | 372 | #endif /* _LINUX_MEMCONTROL_H */ |
| 356 | 373 | ||
