diff options
Diffstat (limited to 'include/linux/memcontrol.h')
-rw-r--r-- | include/linux/memcontrol.h | 105 |
1 files changed, 66 insertions, 39 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index f944591765eb..4d34356fe644 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -32,13 +32,11 @@ enum mem_cgroup_page_stat_item { | |||
32 | MEMCG_NR_FILE_MAPPED, /* # of pages charged as file rss */ | 32 | MEMCG_NR_FILE_MAPPED, /* # of pages charged as file rss */ |
33 | }; | 33 | }; |
34 | 34 | ||
35 | extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, | 35 | struct mem_cgroup_reclaim_cookie { |
36 | struct list_head *dst, | 36 | struct zone *zone; |
37 | unsigned long *scanned, int order, | 37 | int priority; |
38 | isolate_mode_t mode, | 38 | unsigned int generation; |
39 | struct zone *z, | 39 | }; |
40 | struct mem_cgroup *mem_cont, | ||
41 | int active, int file); | ||
42 | 40 | ||
43 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | 41 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR |
44 | /* | 42 | /* |
@@ -56,20 +54,21 @@ extern int mem_cgroup_newpage_charge(struct page *page, struct mm_struct *mm, | |||
56 | gfp_t gfp_mask); | 54 | gfp_t gfp_mask); |
57 | /* for swap handling */ | 55 | /* for swap handling */ |
58 | extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm, | 56 | extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm, |
59 | struct page *page, gfp_t mask, struct mem_cgroup **ptr); | 57 | struct page *page, gfp_t mask, struct mem_cgroup **memcgp); |
60 | extern void mem_cgroup_commit_charge_swapin(struct page *page, | 58 | extern void mem_cgroup_commit_charge_swapin(struct page *page, |
61 | struct mem_cgroup *ptr); | 59 | struct mem_cgroup *memcg); |
62 | extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr); | 60 | extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg); |
63 | 61 | ||
64 | extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, | 62 | extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, |
65 | gfp_t gfp_mask); | 63 | gfp_t gfp_mask); |
66 | extern void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru); | 64 | |
67 | extern void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru); | 65 | struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *); |
68 | extern void mem_cgroup_rotate_reclaimable_page(struct page *page); | 66 | struct lruvec *mem_cgroup_lru_add_list(struct zone *, struct page *, |
69 | extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru); | 67 | enum lru_list); |
70 | extern void mem_cgroup_del_lru(struct page *page); | 68 | void mem_cgroup_lru_del_list(struct page *, enum lru_list); |
71 | extern void mem_cgroup_move_lists(struct page *page, | 69 | void mem_cgroup_lru_del(struct page *); |
72 | enum lru_list from, enum lru_list to); | 70 | struct lruvec *mem_cgroup_lru_move_lists(struct zone *, struct page *, |
71 | enum lru_list, enum lru_list); | ||
73 | 72 | ||
74 | /* For coalescing uncharge for reducing memcg' overhead*/ | 73 | /* For coalescing uncharge for reducing memcg' overhead*/ |
75 | extern void mem_cgroup_uncharge_start(void); | 74 | extern void mem_cgroup_uncharge_start(void); |
@@ -102,10 +101,15 @@ extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg); | |||
102 | 101 | ||
103 | extern int | 102 | extern int |
104 | mem_cgroup_prepare_migration(struct page *page, | 103 | mem_cgroup_prepare_migration(struct page *page, |
105 | struct page *newpage, struct mem_cgroup **ptr, gfp_t gfp_mask); | 104 | struct page *newpage, struct mem_cgroup **memcgp, gfp_t gfp_mask); |
106 | extern void mem_cgroup_end_migration(struct mem_cgroup *memcg, | 105 | extern void mem_cgroup_end_migration(struct mem_cgroup *memcg, |
107 | struct page *oldpage, struct page *newpage, bool migration_ok); | 106 | struct page *oldpage, struct page *newpage, bool migration_ok); |
108 | 107 | ||
108 | struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *, | ||
109 | struct mem_cgroup *, | ||
110 | struct mem_cgroup_reclaim_cookie *); | ||
111 | void mem_cgroup_iter_break(struct mem_cgroup *, struct mem_cgroup *); | ||
112 | |||
109 | /* | 113 | /* |
110 | * For memory reclaim. | 114 | * For memory reclaim. |
111 | */ | 115 | */ |
@@ -122,7 +126,10 @@ struct zone_reclaim_stat* | |||
122 | mem_cgroup_get_reclaim_stat_from_page(struct page *page); | 126 | mem_cgroup_get_reclaim_stat_from_page(struct page *page); |
123 | extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, | 127 | extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, |
124 | struct task_struct *p); | 128 | struct task_struct *p); |
129 | extern void mem_cgroup_replace_page_cache(struct page *oldpage, | ||
130 | struct page *newpage); | ||
125 | 131 | ||
132 | extern void mem_cgroup_reset_owner(struct page *page); | ||
126 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | 133 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP |
127 | extern int do_swap_account; | 134 | extern int do_swap_account; |
128 | #endif | 135 | #endif |
@@ -157,7 +164,7 @@ u64 mem_cgroup_get_limit(struct mem_cgroup *memcg); | |||
157 | 164 | ||
158 | void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx); | 165 | void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx); |
159 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 166 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
160 | void mem_cgroup_split_huge_fixup(struct page *head, struct page *tail); | 167 | void mem_cgroup_split_huge_fixup(struct page *head); |
161 | #endif | 168 | #endif |
162 | 169 | ||
163 | #ifdef CONFIG_DEBUG_VM | 170 | #ifdef CONFIG_DEBUG_VM |
@@ -180,17 +187,17 @@ static inline int mem_cgroup_cache_charge(struct page *page, | |||
180 | } | 187 | } |
181 | 188 | ||
182 | static inline int mem_cgroup_try_charge_swapin(struct mm_struct *mm, | 189 | static inline int mem_cgroup_try_charge_swapin(struct mm_struct *mm, |
183 | struct page *page, gfp_t gfp_mask, struct mem_cgroup **ptr) | 190 | struct page *page, gfp_t gfp_mask, struct mem_cgroup **memcgp) |
184 | { | 191 | { |
185 | return 0; | 192 | return 0; |
186 | } | 193 | } |
187 | 194 | ||
188 | static inline void mem_cgroup_commit_charge_swapin(struct page *page, | 195 | static inline void mem_cgroup_commit_charge_swapin(struct page *page, |
189 | struct mem_cgroup *ptr) | 196 | struct mem_cgroup *memcg) |
190 | { | 197 | { |
191 | } | 198 | } |
192 | 199 | ||
193 | static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr) | 200 | static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg) |
194 | { | 201 | { |
195 | } | 202 | } |
196 | 203 | ||
@@ -210,33 +217,33 @@ static inline void mem_cgroup_uncharge_cache_page(struct page *page) | |||
210 | { | 217 | { |
211 | } | 218 | } |
212 | 219 | ||
213 | static inline void mem_cgroup_add_lru_list(struct page *page, int lru) | 220 | static inline struct lruvec *mem_cgroup_zone_lruvec(struct zone *zone, |
214 | { | 221 | struct mem_cgroup *memcg) |
215 | } | ||
216 | |||
217 | static inline void mem_cgroup_del_lru_list(struct page *page, int lru) | ||
218 | { | 222 | { |
219 | return ; | 223 | return &zone->lruvec; |
220 | } | 224 | } |
221 | 225 | ||
222 | static inline void mem_cgroup_rotate_reclaimable_page(struct page *page) | 226 | static inline struct lruvec *mem_cgroup_lru_add_list(struct zone *zone, |
227 | struct page *page, | ||
228 | enum lru_list lru) | ||
223 | { | 229 | { |
224 | return ; | 230 | return &zone->lruvec; |
225 | } | 231 | } |
226 | 232 | ||
227 | static inline void mem_cgroup_rotate_lru_list(struct page *page, int lru) | 233 | static inline void mem_cgroup_lru_del_list(struct page *page, enum lru_list lru) |
228 | { | 234 | { |
229 | return ; | ||
230 | } | 235 | } |
231 | 236 | ||
232 | static inline void mem_cgroup_del_lru(struct page *page) | 237 | static inline void mem_cgroup_lru_del(struct page *page) |
233 | { | 238 | { |
234 | return ; | ||
235 | } | 239 | } |
236 | 240 | ||
237 | static inline void | 241 | static inline struct lruvec *mem_cgroup_lru_move_lists(struct zone *zone, |
238 | mem_cgroup_move_lists(struct page *page, enum lru_list from, enum lru_list to) | 242 | struct page *page, |
243 | enum lru_list from, | ||
244 | enum lru_list to) | ||
239 | { | 245 | { |
246 | return &zone->lruvec; | ||
240 | } | 247 | } |
241 | 248 | ||
242 | static inline struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page) | 249 | static inline struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page) |
@@ -269,7 +276,7 @@ static inline struct cgroup_subsys_state | |||
269 | 276 | ||
270 | static inline int | 277 | static inline int |
271 | mem_cgroup_prepare_migration(struct page *page, struct page *newpage, | 278 | mem_cgroup_prepare_migration(struct page *page, struct page *newpage, |
272 | struct mem_cgroup **ptr, gfp_t gfp_mask) | 279 | struct mem_cgroup **memcgp, gfp_t gfp_mask) |
273 | { | 280 | { |
274 | return 0; | 281 | return 0; |
275 | } | 282 | } |
@@ -279,6 +286,19 @@ static inline void mem_cgroup_end_migration(struct mem_cgroup *memcg, | |||
279 | { | 286 | { |
280 | } | 287 | } |
281 | 288 | ||
289 | static inline struct mem_cgroup * | ||
290 | mem_cgroup_iter(struct mem_cgroup *root, | ||
291 | struct mem_cgroup *prev, | ||
292 | struct mem_cgroup_reclaim_cookie *reclaim) | ||
293 | { | ||
294 | return NULL; | ||
295 | } | ||
296 | |||
297 | static inline void mem_cgroup_iter_break(struct mem_cgroup *root, | ||
298 | struct mem_cgroup *prev) | ||
299 | { | ||
300 | } | ||
301 | |||
282 | static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *memcg) | 302 | static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *memcg) |
283 | { | 303 | { |
284 | return 0; | 304 | return 0; |
@@ -360,8 +380,7 @@ u64 mem_cgroup_get_limit(struct mem_cgroup *memcg) | |||
360 | return 0; | 380 | return 0; |
361 | } | 381 | } |
362 | 382 | ||
363 | static inline void mem_cgroup_split_huge_fixup(struct page *head, | 383 | static inline void mem_cgroup_split_huge_fixup(struct page *head) |
364 | struct page *tail) | ||
365 | { | 384 | { |
366 | } | 385 | } |
367 | 386 | ||
@@ -369,6 +388,14 @@ static inline | |||
369 | void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx) | 388 | void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx) |
370 | { | 389 | { |
371 | } | 390 | } |
391 | static inline void mem_cgroup_replace_page_cache(struct page *oldpage, | ||
392 | struct page *newpage) | ||
393 | { | ||
394 | } | ||
395 | |||
396 | static inline void mem_cgroup_reset_owner(struct page *page) | ||
397 | { | ||
398 | } | ||
372 | #endif /* CONFIG_CGROUP_MEM_CONT */ | 399 | #endif /* CONFIG_CGROUP_MEM_CONT */ |
373 | 400 | ||
374 | #if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM) | 401 | #if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM) |