aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memcontrol.h
diff options
context:
space:
mode:
authorHugh Dickins <hughd@google.com>2012-05-29 18:07:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-29 19:22:28 -0400
commitfa9add641b1b1c564db916accac1db346e7a2759 (patch)
tree875e74ec4d7fed0018fdbc134ad899949c5e3384 /include/linux/memcontrol.h
parent75b00af77ed5b5a3d55549f9e0c33f3969b9330c (diff)
mm/memcg: apply add/del_page to lruvec
Take lruvec further: pass it instead of zone to add_page_to_lru_list() and del_page_from_lru_list(); and pagevec_lru_move_fn() pass lruvec down to its target functions. This cleanup eliminates a swathe of cruft in memcontrol.c, including mem_cgroup_lru_add_list(), mem_cgroup_lru_del_list() and mem_cgroup_lru_move_lists() - which never actually touched the lists. In their place, mem_cgroup_page_lruvec() to decide the lruvec, previously a side-effect of add, and mem_cgroup_update_lru_size() to maintain the lru_size stats. Whilst these are simplifications in their own right, the goal is to bring the evaluation of lruvec next to the spin_locking of the lrus, in preparation for a future patch. Signed-off-by: Hugh Dickins <hughd@google.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Michal Hocko <mhocko@suse.cz> Acked-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Cc: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/memcontrol.h')
-rw-r--r--include/linux/memcontrol.h32
1 files changed, 7 insertions, 25 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 609ef7c28c6c..83e7ba90d6e5 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -63,11 +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);
69struct lruvec *mem_cgroup_lru_move_lists(struct zone *, struct page *,
70 enum lru_list, enum lru_list);
71 67
72/* For coalescing uncharge for reducing memcg' overhead*/ 68/* For coalescing uncharge for reducing memcg' overhead*/
73extern void mem_cgroup_uncharge_start(void); 69extern void mem_cgroup_uncharge_start(void);
@@ -122,8 +118,7 @@ int mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec);
122int mem_cgroup_inactive_file_is_low(struct lruvec *lruvec); 118int mem_cgroup_inactive_file_is_low(struct lruvec *lruvec);
123int mem_cgroup_select_victim_node(struct mem_cgroup *memcg); 119int mem_cgroup_select_victim_node(struct mem_cgroup *memcg);
124unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list); 120unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list);
125struct zone_reclaim_stat* 121void mem_cgroup_update_lru_size(struct lruvec *, enum lru_list, int);
126mem_cgroup_get_reclaim_stat_from_page(struct page *page);
127extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, 122extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
128 struct task_struct *p); 123 struct task_struct *p);
129extern void mem_cgroup_replace_page_cache(struct page *oldpage, 124extern void mem_cgroup_replace_page_cache(struct page *oldpage,
@@ -250,21 +245,8 @@ static inline struct lruvec *mem_cgroup_zone_lruvec(struct zone *zone,
250 return &zone->lruvec; 245 return &zone->lruvec;
251} 246}
252 247
253static inline struct lruvec *mem_cgroup_lru_add_list(struct zone *zone, 248static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page,
254 struct page *page, 249 struct zone *zone)
255 enum lru_list lru)
256{
257 return &zone->lruvec;
258}
259
260static inline void mem_cgroup_lru_del_list(struct page *page, enum lru_list lru)
261{
262}
263
264static inline struct lruvec *mem_cgroup_lru_move_lists(struct zone *zone,
265 struct page *page,
266 enum lru_list from,
267 enum lru_list to)
268{ 250{
269 return &zone->lruvec; 251 return &zone->lruvec;
270} 252}
@@ -345,10 +327,10 @@ mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru)
345 return 0; 327 return 0;
346} 328}
347 329
348static inline struct zone_reclaim_stat* 330static inline void
349mem_cgroup_get_reclaim_stat_from_page(struct page *page) 331mem_cgroup_update_lru_size(struct lruvec *lruvec, enum lru_list lru,
332 int increment)
350{ 333{
351 return NULL;
352} 334}
353 335
354static inline void 336static inline void