diff options
Diffstat (limited to 'include/linux/memcontrol.h')
-rw-r--r-- | include/linux/memcontrol.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index c54e5dfa1962..bf7ae01fc93b 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -141,6 +141,31 @@ 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 | static inline void mem_cgroup_begin_update_page_stat(struct page *page, | ||
148 | bool *locked, unsigned long *flags) | ||
149 | { | ||
150 | if (mem_cgroup_disabled()) | ||
151 | return; | ||
152 | rcu_read_lock(); | ||
153 | *locked = false; | ||
154 | return __mem_cgroup_begin_update_page_stat(page, locked, flags); | ||
155 | } | ||
156 | |||
157 | void __mem_cgroup_end_update_page_stat(struct page *page, | ||
158 | unsigned long *flags); | ||
159 | static inline void mem_cgroup_end_update_page_stat(struct page *page, | ||
160 | bool *locked, unsigned long *flags) | ||
161 | { | ||
162 | if (mem_cgroup_disabled()) | ||
163 | return; | ||
164 | if (*locked) | ||
165 | __mem_cgroup_end_update_page_stat(page, flags); | ||
166 | rcu_read_unlock(); | ||
167 | } | ||
168 | |||
144 | void mem_cgroup_update_page_stat(struct page *page, | 169 | void mem_cgroup_update_page_stat(struct page *page, |
145 | enum mem_cgroup_page_stat_item idx, | 170 | enum mem_cgroup_page_stat_item idx, |
146 | int val); | 171 | int val); |
@@ -341,6 +366,16 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
341 | { | 366 | { |
342 | } | 367 | } |
343 | 368 | ||
369 | static inline void mem_cgroup_begin_update_page_stat(struct page *page, | ||
370 | bool *locked, unsigned long *flags) | ||
371 | { | ||
372 | } | ||
373 | |||
374 | static inline void mem_cgroup_end_update_page_stat(struct page *page, | ||
375 | bool *locked, unsigned long *flags) | ||
376 | { | ||
377 | } | ||
378 | |||
344 | static inline void mem_cgroup_inc_page_stat(struct page *page, | 379 | static inline void mem_cgroup_inc_page_stat(struct page *page, |
345 | enum mem_cgroup_page_stat_item idx) | 380 | enum mem_cgroup_page_stat_item idx) |
346 | { | 381 | { |