aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memcontrol.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/memcontrol.h')
-rw-r--r--include/linux/memcontrol.h69
1 files changed, 19 insertions, 50 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index f94efd2f6c27..83e7ba90d6e5 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -63,12 +63,7 @@ extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
63 gfp_t gfp_mask); 63 gfp_t gfp_mask);
64 64
65struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *); 65struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *);
66struct lruvec *mem_cgroup_lru_add_list(struct zone *, struct page *, 66struct lruvec *mem_cgroup_page_lruvec(struct page *, struct zone *);
67 enum lru_list);
68void mem_cgroup_lru_del_list(struct page *, enum lru_list);
69void mem_cgroup_lru_del(struct page *);
70struct lruvec *mem_cgroup_lru_move_lists(struct zone *, struct page *,
71 enum lru_list, enum lru_list);
72 67
73/* For coalescing uncharge for reducing memcg' overhead*/ 68/* For coalescing uncharge for reducing memcg' overhead*/
74extern void mem_cgroup_uncharge_start(void); 69extern void mem_cgroup_uncharge_start(void);
@@ -79,6 +74,8 @@ extern void mem_cgroup_uncharge_cache_page(struct page *page);
79 74
80extern void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask, 75extern void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
81 int order); 76 int order);
77bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg,
78 struct mem_cgroup *memcg);
82int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg); 79int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg);
83 80
84extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); 81extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
@@ -92,10 +89,13 @@ static inline
92int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup) 89int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
93{ 90{
94 struct mem_cgroup *memcg; 91 struct mem_cgroup *memcg;
92 int match;
93
95 rcu_read_lock(); 94 rcu_read_lock();
96 memcg = mem_cgroup_from_task(rcu_dereference((mm)->owner)); 95 memcg = mem_cgroup_from_task(rcu_dereference((mm)->owner));
96 match = __mem_cgroup_same_or_subtree(cgroup, memcg);
97 rcu_read_unlock(); 97 rcu_read_unlock();
98 return cgroup == memcg; 98 return match;
99} 99}
100 100
101extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg); 101extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg);
@@ -114,17 +114,11 @@ void mem_cgroup_iter_break(struct mem_cgroup *, struct mem_cgroup *);
114/* 114/*
115 * For memory reclaim. 115 * For memory reclaim.
116 */ 116 */
117int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg, 117int mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec);
118 struct zone *zone); 118int mem_cgroup_inactive_file_is_low(struct lruvec *lruvec);
119int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg,
120 struct zone *zone);
121int mem_cgroup_select_victim_node(struct mem_cgroup *memcg); 119int mem_cgroup_select_victim_node(struct mem_cgroup *memcg);
122unsigned long mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg, 120unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list);
123 int nid, int zid, unsigned int lrumask); 121void mem_cgroup_update_lru_size(struct lruvec *, enum lru_list, int);
124struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg,
125 struct zone *zone);
126struct zone_reclaim_stat*
127mem_cgroup_get_reclaim_stat_from_page(struct page *page);
128extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, 122extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
129 struct task_struct *p); 123 struct task_struct *p);
130extern void mem_cgroup_replace_page_cache(struct page *oldpage, 124extern void mem_cgroup_replace_page_cache(struct page *oldpage,
@@ -251,25 +245,8 @@ static inline struct lruvec *mem_cgroup_zone_lruvec(struct zone *zone,
251 return &zone->lruvec; 245 return &zone->lruvec;
252} 246}
253 247
254static inline struct lruvec *mem_cgroup_lru_add_list(struct zone *zone, 248static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page,
255 struct page *page, 249 struct zone *zone)
256 enum lru_list lru)
257{
258 return &zone->lruvec;
259}
260
261static inline void mem_cgroup_lru_del_list(struct page *page, enum lru_list lru)
262{
263}
264
265static inline void mem_cgroup_lru_del(struct page *page)
266{
267}
268
269static inline struct lruvec *mem_cgroup_lru_move_lists(struct zone *zone,
270 struct page *page,
271 enum lru_list from,
272 enum lru_list to)
273{ 250{
274 return &zone->lruvec; 251 return &zone->lruvec;
275} 252}
@@ -333,35 +310,27 @@ static inline bool mem_cgroup_disabled(void)
333} 310}
334 311
335static inline int 312static inline int
336mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg, struct zone *zone) 313mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec)
337{ 314{
338 return 1; 315 return 1;
339} 316}
340 317
341static inline int 318static inline int
342mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg, struct zone *zone) 319mem_cgroup_inactive_file_is_low(struct lruvec *lruvec)
343{ 320{
344 return 1; 321 return 1;
345} 322}
346 323
347static inline unsigned long 324static inline unsigned long
348mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg, int nid, int zid, 325mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru)
349 unsigned int lru_mask)
350{ 326{
351 return 0; 327 return 0;
352} 328}
353 329
354 330static inline void
355static inline struct zone_reclaim_stat* 331mem_cgroup_update_lru_size(struct lruvec *lruvec, enum lru_list lru,
356mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg, struct zone *zone) 332 int increment)
357{
358 return NULL;
359}
360
361static inline struct zone_reclaim_stat*
362mem_cgroup_get_reclaim_stat_from_page(struct page *page)
363{ 333{
364 return NULL;
365} 334}
366 335
367static inline void 336static inline void