diff options
| author | Tejun Heo <tj@kernel.org> | 2013-11-22 18:20:43 -0500 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2013-11-22 18:20:43 -0500 |
| commit | fba94807837850e211f8975e1970e23e7804ff4d (patch) | |
| tree | c26b1b43027424574532e3fa74ed4656e445334a /include/linux | |
| parent | b5557c4c3b1a38074d7001b87c2482eda3a0834a (diff) | |
cgroup, memcg: move cgroup->event_list[_lock] and event callbacks into memcg
cgroup_event is being moved from cgroup core to memcg and the
implementation is already moved by the previous patch. This patch
moves the data fields and callbacks.
* cgroup->event_list[_lock] are moved to mem_cgroup.
* cftype->[un]register_event() are moved to cgroup_event. This makes
it impossible for individual cftype definitions to specify their
event callbacks. This is worked around by simply hard-coding
filename to event callback mapping in cgroup_write_event_control().
This is awkward and inflexible, which is actually desirable given
that we don't want to grow more usages of this feature.
* eventfd_ctx declaration is removed from cgroup.h, which makes
vmpressure.h miss eventfd_ctx declaration. Include eventfd.h from
vmpressure.h.
v2: Use file name from dentry instead of cftype. This will allow
removing all cftype handling in the function.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Balbir Singh <bsingharora@gmail.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/cgroup.h | 24 | ||||
| -rw-r--r-- | include/linux/vmpressure.h | 1 |
2 files changed, 1 insertions, 24 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 40c2427806c9..612adc5b87c5 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
| @@ -29,7 +29,6 @@ struct cgroup_subsys; | |||
| 29 | struct inode; | 29 | struct inode; |
| 30 | struct cgroup; | 30 | struct cgroup; |
| 31 | struct css_id; | 31 | struct css_id; |
| 32 | struct eventfd_ctx; | ||
| 33 | 32 | ||
| 34 | extern int cgroup_init_early(void); | 33 | extern int cgroup_init_early(void); |
| 35 | extern int cgroup_init(void); | 34 | extern int cgroup_init(void); |
| @@ -239,10 +238,6 @@ struct cgroup { | |||
| 239 | struct rcu_head rcu_head; | 238 | struct rcu_head rcu_head; |
| 240 | struct work_struct destroy_work; | 239 | struct work_struct destroy_work; |
| 241 | 240 | ||
| 242 | /* List of events which userspace want to receive */ | ||
| 243 | struct list_head event_list; | ||
| 244 | spinlock_t event_list_lock; | ||
| 245 | |||
| 246 | /* directory xattrs */ | 241 | /* directory xattrs */ |
| 247 | struct simple_xattrs xattrs; | 242 | struct simple_xattrs xattrs; |
| 248 | }; | 243 | }; |
| @@ -506,25 +501,6 @@ struct cftype { | |||
| 506 | int (*trigger)(struct cgroup_subsys_state *css, unsigned int event); | 501 | int (*trigger)(struct cgroup_subsys_state *css, unsigned int event); |
| 507 | 502 | ||
| 508 | int (*release)(struct inode *inode, struct file *file); | 503 | int (*release)(struct inode *inode, struct file *file); |
| 509 | |||
| 510 | /* | ||
| 511 | * register_event() callback will be used to add new userspace | ||
| 512 | * waiter for changes related to the cftype. Implement it if | ||
| 513 | * you want to provide this functionality. Use eventfd_signal() | ||
| 514 | * on eventfd to send notification to userspace. | ||
| 515 | */ | ||
| 516 | int (*register_event)(struct cgroup_subsys_state *css, | ||
| 517 | struct cftype *cft, struct eventfd_ctx *eventfd, | ||
| 518 | const char *args); | ||
| 519 | /* | ||
| 520 | * unregister_event() callback will be called when userspace | ||
| 521 | * closes the eventfd or on cgroup removing. | ||
| 522 | * This callback must be implemented, if you want provide | ||
| 523 | * notification functionality. | ||
| 524 | */ | ||
| 525 | void (*unregister_event)(struct cgroup_subsys_state *css, | ||
| 526 | struct cftype *cft, | ||
| 527 | struct eventfd_ctx *eventfd); | ||
| 528 | }; | 504 | }; |
| 529 | 505 | ||
| 530 | /* | 506 | /* |
diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h index 3f3788d49362..9dd1914f1a6c 100644 --- a/include/linux/vmpressure.h +++ b/include/linux/vmpressure.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <linux/gfp.h> | 7 | #include <linux/gfp.h> |
| 8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
| 9 | #include <linux/cgroup.h> | 9 | #include <linux/cgroup.h> |
| 10 | #include <linux/eventfd.h> | ||
| 10 | 11 | ||
| 11 | struct vmpressure { | 12 | struct vmpressure { |
| 12 | unsigned long scanned; | 13 | unsigned long scanned; |
