aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/memcontrol.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 975e89935d52..160101a05b4d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -456,16 +456,20 @@ int mem_cgroup_charge(struct page *page, struct mm_struct *mm,
456int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, 456int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
457 gfp_t gfp_mask) 457 gfp_t gfp_mask)
458{ 458{
459 int ret = 0;
459 struct mem_cgroup *mem; 460 struct mem_cgroup *mem;
460 if (!mm) 461 if (!mm)
461 mm = &init_mm; 462 mm = &init_mm;
462 463
464 rcu_read_lock();
463 mem = rcu_dereference(mm->mem_cgroup); 465 mem = rcu_dereference(mm->mem_cgroup);
466 css_get(&mem->css);
467 rcu_read_unlock();
464 if (mem->control_type == MEM_CGROUP_TYPE_ALL) 468 if (mem->control_type == MEM_CGROUP_TYPE_ALL)
465 return mem_cgroup_charge_common(page, mm, gfp_mask, 469 ret = mem_cgroup_charge_common(page, mm, gfp_mask,
466 MEM_CGROUP_CHARGE_TYPE_CACHE); 470 MEM_CGROUP_CHARGE_TYPE_CACHE);
467 else 471 css_put(&mem->css);
468 return 0; 472 return ret;
469} 473}
470 474
471/* 475/*