diff options
Diffstat (limited to 'include/linux/memcontrol.h')
-rw-r--r-- | include/linux/memcontrol.h | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 4d34356fe644..f94efd2f6c27 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -77,7 +77,8 @@ extern void mem_cgroup_uncharge_end(void); | |||
77 | extern void mem_cgroup_uncharge_page(struct page *page); | 77 | extern void mem_cgroup_uncharge_page(struct page *page); |
78 | extern void mem_cgroup_uncharge_cache_page(struct page *page); | 78 | extern void mem_cgroup_uncharge_cache_page(struct page *page); |
79 | 79 | ||
80 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask); | 80 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask, |
81 | int order); | ||
81 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg); | 82 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg); |
82 | 83 | ||
83 | extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); | 84 | extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); |
@@ -129,7 +130,6 @@ extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, | |||
129 | extern void mem_cgroup_replace_page_cache(struct page *oldpage, | 130 | extern void mem_cgroup_replace_page_cache(struct page *oldpage, |
130 | struct page *newpage); | 131 | struct page *newpage); |
131 | 132 | ||
132 | extern void mem_cgroup_reset_owner(struct page *page); | ||
133 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | 133 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP |
134 | extern int do_swap_account; | 134 | extern int do_swap_account; |
135 | #endif | 135 | #endif |
@@ -141,6 +141,34 @@ static inline bool mem_cgroup_disabled(void) | |||
141 | return false; | 141 | return false; |
142 | } | 142 | } |
143 | 143 | ||
144 | void __mem_cgroup_begin_update_page_stat(struct page *page, bool *locked, | ||
145 | unsigned long *flags); | ||
146 | |||
147 | extern atomic_t memcg_moving; | ||
148 | |||
149 | static inline void mem_cgroup_begin_update_page_stat(struct page *page, | ||
150 | bool *locked, unsigned long *flags) | ||
151 | { | ||
152 | if (mem_cgroup_disabled()) | ||
153 | return; | ||
154 | rcu_read_lock(); | ||
155 | *locked = false; | ||
156 | if (atomic_read(&memcg_moving)) | ||
157 | __mem_cgroup_begin_update_page_stat(page, locked, flags); | ||
158 | } | ||
159 | |||
160 | void __mem_cgroup_end_update_page_stat(struct page *page, | ||
161 | unsigned long *flags); | ||
162 | static inline void mem_cgroup_end_update_page_stat(struct page *page, | ||
163 | bool *locked, unsigned long *flags) | ||
164 | { | ||
165 | if (mem_cgroup_disabled()) | ||
166 | return; | ||
167 | if (*locked) | ||
168 | __mem_cgroup_end_update_page_stat(page, flags); | ||
169 | rcu_read_unlock(); | ||
170 | } | ||
171 | |||
144 | void mem_cgroup_update_page_stat(struct page *page, | 172 | void mem_cgroup_update_page_stat(struct page *page, |
145 | enum mem_cgroup_page_stat_item idx, | 173 | enum mem_cgroup_page_stat_item idx, |
146 | int val); | 174 | int val); |
@@ -299,21 +327,6 @@ static inline void mem_cgroup_iter_break(struct mem_cgroup *root, | |||
299 | { | 327 | { |
300 | } | 328 | } |
301 | 329 | ||
302 | static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *memcg) | ||
303 | { | ||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | static inline void mem_cgroup_note_reclaim_priority(struct mem_cgroup *memcg, | ||
308 | int priority) | ||
309 | { | ||
310 | } | ||
311 | |||
312 | static inline void mem_cgroup_record_reclaim_priority(struct mem_cgroup *memcg, | ||
313 | int priority) | ||
314 | { | ||
315 | } | ||
316 | |||
317 | static inline bool mem_cgroup_disabled(void) | 330 | static inline bool mem_cgroup_disabled(void) |
318 | { | 331 | { |
319 | return true; | 332 | return true; |
@@ -356,6 +369,16 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
356 | { | 369 | { |
357 | } | 370 | } |
358 | 371 | ||
372 | static inline void mem_cgroup_begin_update_page_stat(struct page *page, | ||
373 | bool *locked, unsigned long *flags) | ||
374 | { | ||
375 | } | ||
376 | |||
377 | static inline void mem_cgroup_end_update_page_stat(struct page *page, | ||
378 | bool *locked, unsigned long *flags) | ||
379 | { | ||
380 | } | ||
381 | |||
359 | static inline void mem_cgroup_inc_page_stat(struct page *page, | 382 | static inline void mem_cgroup_inc_page_stat(struct page *page, |
360 | enum mem_cgroup_page_stat_item idx) | 383 | enum mem_cgroup_page_stat_item idx) |
361 | { | 384 | { |
@@ -392,11 +415,7 @@ static inline void mem_cgroup_replace_page_cache(struct page *oldpage, | |||
392 | struct page *newpage) | 415 | struct page *newpage) |
393 | { | 416 | { |
394 | } | 417 | } |
395 | 418 | #endif /* CONFIG_CGROUP_MEM_RES_CTLR */ | |
396 | static inline void mem_cgroup_reset_owner(struct page *page) | ||
397 | { | ||
398 | } | ||
399 | #endif /* CONFIG_CGROUP_MEM_CONT */ | ||
400 | 419 | ||
401 | #if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM) | 420 | #if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM) |
402 | static inline bool | 421 | static inline bool |