diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/cgroup.h | 15 | ||||
-rw-r--r-- | include/linux/memcontrol.h | 16 | ||||
-rw-r--r-- | include/linux/mm_types.h | 5 | ||||
-rw-r--r-- | include/linux/sched.h | 13 |
4 files changed, 34 insertions, 15 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 095248082b7e..e155aa78d859 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -305,6 +305,12 @@ struct cgroup_subsys { | |||
305 | struct cgroup *cgrp); | 305 | struct cgroup *cgrp); |
306 | void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); | 306 | void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); |
307 | void (*bind)(struct cgroup_subsys *ss, struct cgroup *root); | 307 | void (*bind)(struct cgroup_subsys *ss, struct cgroup *root); |
308 | /* | ||
309 | * This routine is called with the task_lock of mm->owner held | ||
310 | */ | ||
311 | void (*mm_owner_changed)(struct cgroup_subsys *ss, | ||
312 | struct cgroup *old, | ||
313 | struct cgroup *new); | ||
308 | int subsys_id; | 314 | int subsys_id; |
309 | int active; | 315 | int active; |
310 | int disabled; | 316 | int disabled; |
@@ -390,4 +396,13 @@ static inline int cgroupstats_build(struct cgroupstats *stats, | |||
390 | 396 | ||
391 | #endif /* !CONFIG_CGROUPS */ | 397 | #endif /* !CONFIG_CGROUPS */ |
392 | 398 | ||
399 | #ifdef CONFIG_MM_OWNER | ||
400 | extern void | ||
401 | cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new); | ||
402 | #else /* !CONFIG_MM_OWNER */ | ||
403 | static inline void | ||
404 | cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new) | ||
405 | { | ||
406 | } | ||
407 | #endif /* CONFIG_MM_OWNER */ | ||
393 | #endif /* _LINUX_CGROUP_H */ | 408 | #endif /* _LINUX_CGROUP_H */ |
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 8b1c4295848b..e6608776bc96 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -27,9 +27,6 @@ struct mm_struct; | |||
27 | 27 | ||
28 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | 28 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR |
29 | 29 | ||
30 | extern void mm_init_cgroup(struct mm_struct *mm, struct task_struct *p); | ||
31 | extern void mm_free_cgroup(struct mm_struct *mm); | ||
32 | |||
33 | #define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0) | 30 | #define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0) |
34 | 31 | ||
35 | extern struct page_cgroup *page_get_page_cgroup(struct page *page); | 32 | extern struct page_cgroup *page_get_page_cgroup(struct page *page); |
@@ -48,8 +45,10 @@ extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, | |||
48 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); | 45 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); |
49 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); | 46 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); |
50 | 47 | ||
48 | extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); | ||
49 | |||
51 | #define mm_match_cgroup(mm, cgroup) \ | 50 | #define mm_match_cgroup(mm, cgroup) \ |
52 | ((cgroup) == rcu_dereference((mm)->mem_cgroup)) | 51 | ((cgroup) == mem_cgroup_from_task((mm)->owner)) |
53 | 52 | ||
54 | extern int mem_cgroup_prepare_migration(struct page *page); | 53 | extern int mem_cgroup_prepare_migration(struct page *page); |
55 | extern void mem_cgroup_end_migration(struct page *page); | 54 | extern void mem_cgroup_end_migration(struct page *page); |
@@ -73,15 +72,6 @@ extern long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem, | |||
73 | struct zone *zone, int priority); | 72 | struct zone *zone, int priority); |
74 | 73 | ||
75 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ | 74 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ |
76 | static inline void mm_init_cgroup(struct mm_struct *mm, | ||
77 | struct task_struct *p) | ||
78 | { | ||
79 | } | ||
80 | |||
81 | static inline void mm_free_cgroup(struct mm_struct *mm) | ||
82 | { | ||
83 | } | ||
84 | |||
85 | static inline void page_reset_bad_cgroup(struct page *page) | 75 | static inline void page_reset_bad_cgroup(struct page *page) |
86 | { | 76 | { |
87 | } | 77 | } |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index e2bae8dde35a..bc97bd54f606 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -225,8 +225,9 @@ struct mm_struct { | |||
225 | /* aio bits */ | 225 | /* aio bits */ |
226 | rwlock_t ioctx_list_lock; /* aio lock */ | 226 | rwlock_t ioctx_list_lock; /* aio lock */ |
227 | struct kioctx *ioctx_list; | 227 | struct kioctx *ioctx_list; |
228 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | 228 | #ifdef CONFIG_MM_OWNER |
229 | struct mem_cgroup *mem_cgroup; | 229 | struct task_struct *owner; /* The thread group leader that */ |
230 | /* owns the mm_struct. */ | ||
230 | #endif | 231 | #endif |
231 | }; | 232 | }; |
232 | 233 | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index 024d72b47a0c..1d02babdb2c7 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -2148,6 +2148,19 @@ static inline void migration_init(void) | |||
2148 | #define TASK_SIZE_OF(tsk) TASK_SIZE | 2148 | #define TASK_SIZE_OF(tsk) TASK_SIZE |
2149 | #endif | 2149 | #endif |
2150 | 2150 | ||
2151 | #ifdef CONFIG_MM_OWNER | ||
2152 | extern void mm_update_next_owner(struct mm_struct *mm); | ||
2153 | extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p); | ||
2154 | #else | ||
2155 | static inline void mm_update_next_owner(struct mm_struct *mm) | ||
2156 | { | ||
2157 | } | ||
2158 | |||
2159 | static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p) | ||
2160 | { | ||
2161 | } | ||
2162 | #endif /* CONFIG_MM_OWNER */ | ||
2163 | |||
2151 | #endif /* __KERNEL__ */ | 2164 | #endif /* __KERNEL__ */ |
2152 | 2165 | ||
2153 | #endif | 2166 | #endif |