diff options
author | David Rientjes <rientjes@google.com> | 2008-02-09 03:10:15 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-09 14:08:33 -0500 |
commit | 60c12b1202a60eabb1c61317e5d2678fcea9893f (patch) | |
tree | 143e5bdbd10d32832fce9183500deebad6c6e4db /mm | |
parent | 6966a97753854c8b5336cf3997d5d1d205d91b12 (diff) |
memcontrol: add vm_match_cgroup()
mm_cgroup() is exclusively used to test whether an mm's mem_cgroup pointer
is pointing to a specific cgroup. Instead of returning the pointer, we can
just do the test itself in a new macro:
vm_match_cgroup(mm, cgroup)
returns non-zero if the mm's mem_cgroup points to cgroup. Otherwise it
returns zero.
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memcontrol.c | 2 | ||||
-rw-r--r-- | mm/rmap.c | 4 |
2 files changed, 3 insertions, 3 deletions
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)) { |