diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/memcontrol.h | 12 | ||||
-rw-r--r-- | include/linux/res_counter.h | 23 | ||||
-rw-r--r-- | include/linux/swap.h | 3 |
3 files changed, 38 insertions, 0 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index f5b47efab48b..9c3c1c97c197 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -32,6 +32,13 @@ extern void page_assign_page_cgroup(struct page *page, | |||
32 | extern struct page_cgroup *page_get_page_cgroup(struct page *page); | 32 | extern struct page_cgroup *page_get_page_cgroup(struct page *page); |
33 | extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm); | 33 | extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm); |
34 | extern void mem_cgroup_uncharge(struct page_cgroup *pc); | 34 | extern void mem_cgroup_uncharge(struct page_cgroup *pc); |
35 | extern void mem_cgroup_move_lists(struct page_cgroup *pc, bool active); | ||
36 | extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, | ||
37 | struct list_head *dst, | ||
38 | unsigned long *scanned, int order, | ||
39 | int mode, struct zone *z, | ||
40 | struct mem_cgroup *mem_cont, | ||
41 | int active); | ||
35 | 42 | ||
36 | static inline void mem_cgroup_uncharge_page(struct page *page) | 43 | static inline void mem_cgroup_uncharge_page(struct page *page) |
37 | { | 44 | { |
@@ -71,6 +78,11 @@ static inline void mem_cgroup_uncharge_page(struct page *page) | |||
71 | { | 78 | { |
72 | } | 79 | } |
73 | 80 | ||
81 | static inline void mem_cgroup_move_lists(struct page_cgroup *pc, | ||
82 | bool active) | ||
83 | { | ||
84 | } | ||
85 | |||
74 | #endif /* CONFIG_CGROUP_MEM_CONT */ | 86 | #endif /* CONFIG_CGROUP_MEM_CONT */ |
75 | 87 | ||
76 | #endif /* _LINUX_MEMCONTROL_H */ | 88 | #endif /* _LINUX_MEMCONTROL_H */ |
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h index eeb3f7749772..5e60a4f34243 100644 --- a/include/linux/res_counter.h +++ b/include/linux/res_counter.h | |||
@@ -99,4 +99,27 @@ int res_counter_charge(struct res_counter *counter, unsigned long val); | |||
99 | void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val); | 99 | void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val); |
100 | void res_counter_uncharge(struct res_counter *counter, unsigned long val); | 100 | void res_counter_uncharge(struct res_counter *counter, unsigned long val); |
101 | 101 | ||
102 | static inline bool res_counter_limit_check_locked(struct res_counter *cnt) | ||
103 | { | ||
104 | if (cnt->usage < cnt->limit) | ||
105 | return true; | ||
106 | |||
107 | return false; | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * Helper function to detect if the cgroup is within it's limit or | ||
112 | * not. It's currently called from cgroup_rss_prepare() | ||
113 | */ | ||
114 | static inline bool res_counter_check_under_limit(struct res_counter *cnt) | ||
115 | { | ||
116 | bool ret; | ||
117 | unsigned long flags; | ||
118 | |||
119 | spin_lock_irqsave(&cnt->lock, flags); | ||
120 | ret = res_counter_limit_check_locked(cnt); | ||
121 | spin_unlock_irqrestore(&cnt->lock, flags); | ||
122 | return ret; | ||
123 | } | ||
124 | |||
102 | #endif | 125 | #endif |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 353153ea0bd5..4d91bc0e0fd5 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/linkage.h> | 5 | #include <linux/linkage.h> |
6 | #include <linux/mmzone.h> | 6 | #include <linux/mmzone.h> |
7 | #include <linux/list.h> | 7 | #include <linux/list.h> |
8 | #include <linux/memcontrol.h> | ||
8 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
9 | 10 | ||
10 | #include <asm/atomic.h> | 11 | #include <asm/atomic.h> |
@@ -182,6 +183,8 @@ extern void swap_setup(void); | |||
182 | /* linux/mm/vmscan.c */ | 183 | /* linux/mm/vmscan.c */ |
183 | extern unsigned long try_to_free_pages(struct zone **zones, int order, | 184 | extern unsigned long try_to_free_pages(struct zone **zones, int order, |
184 | gfp_t gfp_mask); | 185 | gfp_t gfp_mask); |
186 | extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem); | ||
187 | extern int __isolate_lru_page(struct page *page, int mode); | ||
185 | extern unsigned long shrink_all_memory(unsigned long nr_pages); | 188 | extern unsigned long shrink_all_memory(unsigned long nr_pages); |
186 | extern int vm_swappiness; | 189 | extern int vm_swappiness; |
187 | extern int remove_mapping(struct address_space *mapping, struct page *page); | 190 | extern int remove_mapping(struct address_space *mapping, struct page *page); |