aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2008-02-09 03:10:15 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-09 14:08:33 -0500
commit60c12b1202a60eabb1c61317e5d2678fcea9893f (patch)
tree143e5bdbd10d32832fce9183500deebad6c6e4db /include/linux
parent6966a97753854c8b5336cf3997d5d1d205d91b12 (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 'include/linux')
-rw-r--r--include/linux/memcontrol.h10
1 files changed, 4 insertions, 6 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);
52int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); 52int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);
53 53
54static 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
59extern int mem_cgroup_prepare_migration(struct page *page); 57extern int mem_cgroup_prepare_migration(struct page *page);
60extern void mem_cgroup_end_migration(struct page *page); 58extern 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
126static inline struct mem_cgroup *mm_cgroup(const struct mm_struct *mm) 124static 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
131static inline int task_in_mem_cgroup(struct task_struct *task, 129static inline int task_in_mem_cgroup(struct task_struct *task,