Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / include / linux / memcontrol.h
blob3d517dccce5b14cb0252cd8d22fb81355ed0dd49
1 /* memcontrol.h - Memory Controller
3 * Copyright IBM Corporation, 2007
4 * Author Balbir Singh <balbir@linux.vnet.ibm.com>
6 * Copyright 2007 OpenVZ SWsoft Inc
7 * Author: Pavel Emelianov <xemul@openvz.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
20 #ifndef _LINUX_MEMCONTROL_H
21 #define _LINUX_MEMCONTROL_H
23 <<<<<<< HEAD:include/linux/memcontrol.h
24 #include <linux/rcupdate.h>
25 #include <linux/mm.h>
27 =======
28 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/memcontrol.h
29 struct mem_cgroup;
30 struct page_cgroup;
31 struct page;
32 struct mm_struct;
34 <<<<<<< HEAD:include/linux/memcontrol.h
35 #ifdef CONFIG_CGROUP_MEM_CONT
36 =======
37 #ifdef CONFIG_CGROUP_MEM_RES_CTLR
38 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/memcontrol.h
40 extern void mm_init_cgroup(struct mm_struct *mm, struct task_struct *p);
41 extern void mm_free_cgroup(struct mm_struct *mm);
42 <<<<<<< HEAD:include/linux/memcontrol.h
43 extern void page_assign_page_cgroup(struct page *page,
44 struct page_cgroup *pc);
45 =======
47 #define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0)
49 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/memcontrol.h
50 extern struct page_cgroup *page_get_page_cgroup(struct page *page);
51 extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm,
52 gfp_t gfp_mask);
53 <<<<<<< HEAD:include/linux/memcontrol.h
54 extern void mem_cgroup_uncharge(struct page_cgroup *pc);
55 =======
56 extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
57 gfp_t gfp_mask);
58 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/memcontrol.h
59 extern void mem_cgroup_uncharge_page(struct page *page);
60 <<<<<<< HEAD:include/linux/memcontrol.h
61 extern void mem_cgroup_move_lists(struct page_cgroup *pc, bool active);
62 =======
63 extern void mem_cgroup_move_lists(struct page *page, bool active);
64 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/memcontrol.h
65 extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
66 struct list_head *dst,
67 unsigned long *scanned, int order,
68 int mode, struct zone *z,
69 struct mem_cgroup *mem_cont,
70 int active);
71 extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask);
72 <<<<<<< HEAD:include/linux/memcontrol.h
73 extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
74 gfp_t gfp_mask);
75 =======
76 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/memcontrol.h
77 int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);
79 <<<<<<< HEAD:include/linux/memcontrol.h
80 #define vm_match_cgroup(mm, cgroup) \
81 =======
82 #define mm_match_cgroup(mm, cgroup) \
83 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/memcontrol.h
84 ((cgroup) == rcu_dereference((mm)->mem_cgroup))
86 extern int mem_cgroup_prepare_migration(struct page *page);
87 extern void mem_cgroup_end_migration(struct page *page);
88 extern void mem_cgroup_page_migration(struct page *page, struct page *newpage);
91 * For memory reclaim.
93 extern int mem_cgroup_calc_mapped_ratio(struct mem_cgroup *mem);
94 extern long mem_cgroup_reclaim_imbalance(struct mem_cgroup *mem);
96 extern int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem);
97 extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
98 int priority);
99 extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
100 int priority);
102 extern long mem_cgroup_calc_reclaim_active(struct mem_cgroup *mem,
103 struct zone *zone, int priority);
104 extern long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem,
105 struct zone *zone, int priority);
107 <<<<<<< HEAD:include/linux/memcontrol.h
108 #else /* CONFIG_CGROUP_MEM_CONT */
109 =======
110 #else /* CONFIG_CGROUP_MEM_RES_CTLR */
111 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/memcontrol.h
112 static inline void mm_init_cgroup(struct mm_struct *mm,
113 struct task_struct *p)
117 static inline void mm_free_cgroup(struct mm_struct *mm)
121 <<<<<<< HEAD:include/linux/memcontrol.h
122 static inline void page_assign_page_cgroup(struct page *page,
123 struct page_cgroup *pc)
124 =======
125 static inline void page_reset_bad_cgroup(struct page *page)
126 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/memcontrol.h
130 static inline struct page_cgroup *page_get_page_cgroup(struct page *page)
132 return NULL;
135 <<<<<<< HEAD:include/linux/memcontrol.h
136 static inline int mem_cgroup_charge(struct page *page, struct mm_struct *mm,
137 gfp_t gfp_mask)
138 =======
139 static inline int mem_cgroup_charge(struct page *page,
140 struct mm_struct *mm, gfp_t gfp_mask)
141 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/memcontrol.h
143 return 0;
146 <<<<<<< HEAD:include/linux/memcontrol.h
147 static inline void mem_cgroup_uncharge(struct page_cgroup *pc)
148 =======
149 static inline int mem_cgroup_cache_charge(struct page *page,
150 struct mm_struct *mm, gfp_t gfp_mask)
151 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/memcontrol.h
153 <<<<<<< HEAD:include/linux/memcontrol.h
154 =======
155 return 0;
156 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/memcontrol.h
159 static inline void mem_cgroup_uncharge_page(struct page *page)
163 <<<<<<< HEAD:include/linux/memcontrol.h
164 static inline void mem_cgroup_move_lists(struct page_cgroup *pc,
165 bool active)
166 =======
167 static inline void mem_cgroup_move_lists(struct page *page, bool active)
168 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/memcontrol.h
172 <<<<<<< HEAD:include/linux/memcontrol.h
173 static inline int mem_cgroup_cache_charge(struct page *page,
174 struct mm_struct *mm,
175 gfp_t gfp_mask)
177 return 0;
180 static inline int vm_match_cgroup(struct mm_struct *mm, struct mem_cgroup *mem)
181 =======
182 static inline int mm_match_cgroup(struct mm_struct *mm, struct mem_cgroup *mem)
183 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/memcontrol.h
185 return 1;
188 static inline int task_in_mem_cgroup(struct task_struct *task,
189 const struct mem_cgroup *mem)
191 return 1;
194 static inline int mem_cgroup_prepare_migration(struct page *page)
196 return 0;
199 static inline void mem_cgroup_end_migration(struct page *page)
203 static inline void
204 mem_cgroup_page_migration(struct page *page, struct page *newpage)
208 static inline int mem_cgroup_calc_mapped_ratio(struct mem_cgroup *mem)
210 return 0;
213 static inline int mem_cgroup_reclaim_imbalance(struct mem_cgroup *mem)
215 return 0;
218 static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem)
220 return 0;
223 static inline void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
224 int priority)
228 static inline void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
229 int priority)
233 static inline long mem_cgroup_calc_reclaim_active(struct mem_cgroup *mem,
234 struct zone *zone, int priority)
236 return 0;
239 static inline long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem,
240 struct zone *zone, int priority)
242 return 0;
244 #endif /* CONFIG_CGROUP_MEM_CONT */
246 #endif /* _LINUX_MEMCONTROL_H */