aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3a2d54bdf076..0356cb6c9504 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3046,6 +3046,52 @@ int mem_cgroup_shmem_charge_fallback(struct page *page,
3046 return ret; 3046 return ret;
3047} 3047}
3048 3048
3049#ifdef CONFIG_DEBUG_VM
3050static struct page_cgroup *lookup_page_cgroup_used(struct page *page)
3051{
3052 struct page_cgroup *pc;
3053
3054 pc = lookup_page_cgroup(page);
3055 if (likely(pc) && PageCgroupUsed(pc))
3056 return pc;
3057 return NULL;
3058}
3059
3060bool mem_cgroup_bad_page_check(struct page *page)
3061{
3062 if (mem_cgroup_disabled())
3063 return false;
3064
3065 return lookup_page_cgroup_used(page) != NULL;
3066}
3067
3068void mem_cgroup_print_bad_page(struct page *page)
3069{
3070 struct page_cgroup *pc;
3071
3072 pc = lookup_page_cgroup_used(page);
3073 if (pc) {
3074 int ret = -1;
3075 char *path;
3076
3077 printk(KERN_ALERT "pc:%p pc->flags:%lx pc->mem_cgroup:%p",
3078 pc, pc->flags, pc->mem_cgroup);
3079
3080 path = kmalloc(PATH_MAX, GFP_KERNEL);
3081 if (path) {
3082 rcu_read_lock();
3083 ret = cgroup_path(pc->mem_cgroup->css.cgroup,
3084 path, PATH_MAX);
3085 rcu_read_unlock();
3086 }
3087
3088 printk(KERN_CONT "(%s)\n",
3089 (ret < 0) ? "cannot get the path" : path);
3090 kfree(path);
3091 }
3092}
3093#endif
3094
3049static DEFINE_MUTEX(set_limit_mutex); 3095static DEFINE_MUTEX(set_limit_mutex);
3050 3096
3051static int mem_cgroup_resize_limit(struct mem_cgroup *memcg, 3097static int mem_cgroup_resize_limit(struct mem_cgroup *memcg,