diff options
-rw-r--r-- | include/linux/memcontrol.h | 10 | ||||
-rw-r--r-- | mm/memcontrol.c | 2 | ||||
-rw-r--r-- | mm/rmap.c | 4 |
3 files changed, 7 insertions, 9 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 9815951ec99..925d57b236a 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -51,10 +51,8 @@ extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, gfp_t gfp_mask); int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); -static inline struct mem_cgroup *mm_cgroup(const struct mm_struct *mm) -{ - return rcu_dereference(mm->mem_cgroup); -} +#define vm_match_cgroup(mm, cgroup) \ + ((cgroup) == rcu_dereference((mm)->mem_cgroup)) extern int mem_cgroup_prepare_migration(struct page *page); extern void mem_cgroup_end_migration(struct page *page); @@ -123,9 +121,9 @@ static inline int mem_cgroup_cache_charge(struct page *page, return 0; } -static inline struct mem_cgroup *mm_cgroup(const struct mm_struct *mm) +static inline int vm_match_cgroup(struct mm_struct *mm, struct mem_cgroup *mem) { - return NULL; + return 1; } static inline int task_in_mem_cgroup(struct task_struct *task, diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 5c2c702af61..6bded84c20c 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -399,7 +399,7 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem) int ret; task_lock(task); - ret = task->mm && mm_cgroup(task->mm) == mem; + ret = task->mm && vm_match_cgroup(task->mm, mem); task_unlock(task); return ret; } diff --git a/mm/rmap.c b/mm/rmap.c index a0e92a263d1..8fd527c4e2b 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -321,7 +321,7 @@ static int page_referenced_anon(struct page *page, * counting on behalf of references from different * cgroups */ - if (mem_cont && (mm_cgroup(vma->vm_mm) != mem_cont)) + if (mem_cont && !vm_match_cgroup(vma->vm_mm, mem_cont)) continue; referenced += page_referenced_one(page, vma, &mapcount); if (!mapcount) @@ -382,7 +382,7 @@ static int page_referenced_file(struct page *page, * counting on behalf of references from different * cgroups */ - if (mem_cont && (mm_cgroup(vma->vm_mm) != mem_cont)) + if (mem_cont && !vm_match_cgroup(vma->vm_mm, mem_cont)) continue; if ((vma->vm_flags & (VM_LOCKED|VM_MAYSHARE)) == (VM_LOCKED|VM_MAYSHARE)) { |