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 9815951ec995..925d57b236aa 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, | |||
51 | gfp_t gfp_mask); | 51 | gfp_t gfp_mask); |
52 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); | 52 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); |
53 | 53 | ||
54 | static inline struct mem_cgroup *mm_cgroup(const struct mm_struct *mm) | 54 | #define vm_match_cgroup(mm, cgroup) \ |
55 | { | 55 | ((cgroup) == rcu_dereference((mm)->mem_cgroup)) |
56 | return rcu_dereference(mm->mem_cgroup); | ||
57 | } | ||
58 | 56 | ||
59 | extern int mem_cgroup_prepare_migration(struct page *page); | 57 | extern int mem_cgroup_prepare_migration(struct page *page); |
60 | extern void mem_cgroup_end_migration(struct page *page); | 58 | extern void mem_cgroup_end_migration(struct page *page); |
@@ -123,9 +121,9 @@ static inline int mem_cgroup_cache_charge(struct page *page, | |||
123 | return 0; | 121 | return 0; |
124 | } | 122 | } |
125 | 123 | ||
126 | static inline struct mem_cgroup *mm_cgroup(const struct mm_struct *mm) | 124 | static inline int vm_match_cgroup(struct mm_struct *mm, struct mem_cgroup *mem) |
127 | { | 125 | { |
128 | return NULL; | 126 | return 1; |
129 | } | 127 | } |
130 | 128 | ||
131 | static inline int task_in_mem_cgroup(struct task_struct *task, | 129 | static inline int task_in_mem_cgroup(struct task_struct *task, |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 5c2c702af617..6bded84c20c8 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) | |||
399 | int ret; | 399 | int ret; |
400 | 400 | ||
401 | task_lock(task); | 401 | task_lock(task); |
402 | ret = task->mm && mm_cgroup(task->mm) == mem; | 402 | ret = task->mm && vm_match_cgroup(task->mm, mem); |
403 | task_unlock(task); | 403 | task_unlock(task); |
404 | return ret; | 404 | return ret; |
405 | } | 405 | } |
@@ -321,7 +321,7 @@ static int page_referenced_anon(struct page *page, | |||
321 | * counting on behalf of references from different | 321 | * counting on behalf of references from different |
322 | * cgroups | 322 | * cgroups |
323 | */ | 323 | */ |
324 | if (mem_cont && (mm_cgroup(vma->vm_mm) != mem_cont)) | 324 | if (mem_cont && !vm_match_cgroup(vma->vm_mm, mem_cont)) |
325 | continue; | 325 | continue; |
326 | referenced += page_referenced_one(page, vma, &mapcount); | 326 | referenced += page_referenced_one(page, vma, &mapcount); |
327 | if (!mapcount) | 327 | if (!mapcount) |
@@ -382,7 +382,7 @@ static int page_referenced_file(struct page *page, | |||
382 | * counting on behalf of references from different | 382 | * counting on behalf of references from different |
383 | * cgroups | 383 | * cgroups |
384 | */ | 384 | */ |
385 | if (mem_cont && (mm_cgroup(vma->vm_mm) != mem_cont)) | 385 | if (mem_cont && !vm_match_cgroup(vma->vm_mm, mem_cont)) |
386 | continue; | 386 | continue; |
387 | if ((vma->vm_flags & (VM_LOCKED|VM_MAYSHARE)) | 387 | if ((vma->vm_flags & (VM_LOCKED|VM_MAYSHARE)) |
388 | == (VM_LOCKED|VM_MAYSHARE)) { | 388 | == (VM_LOCKED|VM_MAYSHARE)) { |