diff options
author | Tejun Heo <tj@kernel.org> | 2013-11-22 18:20:44 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-11-22 18:20:44 -0500 |
commit | 3bc942f372af383f49d56aab599469561a5e39ec (patch) | |
tree | 91c92e037eea3f556913a8a2f5699d58fdca5f95 /mm/memcontrol.c | |
parent | 59b6f87344ab5eb3057e5844b8cd8a39e668f477 (diff) |
memcg: rename cgroup_event to mem_cgroup_event
cgroup_event is only available in memcg now. Let's brand it that way.
While at it, add a comment encouraging deprecation of the feature and
remove the respective section from cgroup documentation.
This patch is cosmetic.
v3: Typo update as per Li Zefan.
v2: Index in cgroups.txt updated accordingly as suggested by Li Zefan.
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>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 57 |
1 files changed, 37 insertions, 20 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 42f2843af1a7..ec8582b3a232 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -231,7 +231,7 @@ struct mem_cgroup_eventfd_list { | |||
231 | /* | 231 | /* |
232 | * cgroup_event represents events which userspace want to receive. | 232 | * cgroup_event represents events which userspace want to receive. |
233 | */ | 233 | */ |
234 | struct cgroup_event { | 234 | struct mem_cgroup_event { |
235 | /* | 235 | /* |
236 | * memcg which the event belongs to. | 236 | * memcg which the event belongs to. |
237 | */ | 237 | */ |
@@ -6002,14 +6002,27 @@ static void kmem_cgroup_css_offline(struct mem_cgroup *memcg) | |||
6002 | #endif | 6002 | #endif |
6003 | 6003 | ||
6004 | /* | 6004 | /* |
6005 | * DO NOT USE IN NEW FILES. | ||
6006 | * | ||
6007 | * "cgroup.event_control" implementation. | ||
6008 | * | ||
6009 | * This is way over-engineered. It tries to support fully configurable | ||
6010 | * events for each user. Such level of flexibility is completely | ||
6011 | * unnecessary especially in the light of the planned unified hierarchy. | ||
6012 | * | ||
6013 | * Please deprecate this and replace with something simpler if at all | ||
6014 | * possible. | ||
6015 | */ | ||
6016 | |||
6017 | /* | ||
6005 | * Unregister event and free resources. | 6018 | * Unregister event and free resources. |
6006 | * | 6019 | * |
6007 | * Gets called from workqueue. | 6020 | * Gets called from workqueue. |
6008 | */ | 6021 | */ |
6009 | static void cgroup_event_remove(struct work_struct *work) | 6022 | static void memcg_event_remove(struct work_struct *work) |
6010 | { | 6023 | { |
6011 | struct cgroup_event *event = container_of(work, struct cgroup_event, | 6024 | struct mem_cgroup_event *event = |
6012 | remove); | 6025 | container_of(work, struct mem_cgroup_event, remove); |
6013 | struct mem_cgroup *memcg = event->memcg; | 6026 | struct mem_cgroup *memcg = event->memcg; |
6014 | 6027 | ||
6015 | remove_wait_queue(event->wqh, &event->wait); | 6028 | remove_wait_queue(event->wqh, &event->wait); |
@@ -6029,11 +6042,11 @@ static void cgroup_event_remove(struct work_struct *work) | |||
6029 | * | 6042 | * |
6030 | * Called with wqh->lock held and interrupts disabled. | 6043 | * Called with wqh->lock held and interrupts disabled. |
6031 | */ | 6044 | */ |
6032 | static int cgroup_event_wake(wait_queue_t *wait, unsigned mode, | 6045 | static int memcg_event_wake(wait_queue_t *wait, unsigned mode, |
6033 | int sync, void *key) | 6046 | int sync, void *key) |
6034 | { | 6047 | { |
6035 | struct cgroup_event *event = container_of(wait, | 6048 | struct mem_cgroup_event *event = |
6036 | struct cgroup_event, wait); | 6049 | container_of(wait, struct mem_cgroup_event, wait); |
6037 | struct mem_cgroup *memcg = event->memcg; | 6050 | struct mem_cgroup *memcg = event->memcg; |
6038 | unsigned long flags = (unsigned long)key; | 6051 | unsigned long flags = (unsigned long)key; |
6039 | 6052 | ||
@@ -6062,27 +6075,29 @@ static int cgroup_event_wake(wait_queue_t *wait, unsigned mode, | |||
6062 | return 0; | 6075 | return 0; |
6063 | } | 6076 | } |
6064 | 6077 | ||
6065 | static void cgroup_event_ptable_queue_proc(struct file *file, | 6078 | static void memcg_event_ptable_queue_proc(struct file *file, |
6066 | wait_queue_head_t *wqh, poll_table *pt) | 6079 | wait_queue_head_t *wqh, poll_table *pt) |
6067 | { | 6080 | { |
6068 | struct cgroup_event *event = container_of(pt, | 6081 | struct mem_cgroup_event *event = |
6069 | struct cgroup_event, pt); | 6082 | container_of(pt, struct mem_cgroup_event, pt); |
6070 | 6083 | ||
6071 | event->wqh = wqh; | 6084 | event->wqh = wqh; |
6072 | add_wait_queue(wqh, &event->wait); | 6085 | add_wait_queue(wqh, &event->wait); |
6073 | } | 6086 | } |
6074 | 6087 | ||
6075 | /* | 6088 | /* |
6089 | * DO NOT USE IN NEW FILES. | ||
6090 | * | ||
6076 | * Parse input and register new cgroup event handler. | 6091 | * Parse input and register new cgroup event handler. |
6077 | * | 6092 | * |
6078 | * Input must be in format '<event_fd> <control_fd> <args>'. | 6093 | * Input must be in format '<event_fd> <control_fd> <args>'. |
6079 | * Interpretation of args is defined by control file implementation. | 6094 | * Interpretation of args is defined by control file implementation. |
6080 | */ | 6095 | */ |
6081 | static int cgroup_write_event_control(struct cgroup_subsys_state *css, | 6096 | static int memcg_write_event_control(struct cgroup_subsys_state *css, |
6082 | struct cftype *cft, const char *buffer) | 6097 | struct cftype *cft, const char *buffer) |
6083 | { | 6098 | { |
6084 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); | 6099 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
6085 | struct cgroup_event *event; | 6100 | struct mem_cgroup_event *event; |
6086 | struct cgroup_subsys_state *cfile_css; | 6101 | struct cgroup_subsys_state *cfile_css; |
6087 | unsigned int efd, cfd; | 6102 | unsigned int efd, cfd; |
6088 | struct fd efile; | 6103 | struct fd efile; |
@@ -6107,9 +6122,9 @@ static int cgroup_write_event_control(struct cgroup_subsys_state *css, | |||
6107 | 6122 | ||
6108 | event->memcg = memcg; | 6123 | event->memcg = memcg; |
6109 | INIT_LIST_HEAD(&event->list); | 6124 | INIT_LIST_HEAD(&event->list); |
6110 | init_poll_funcptr(&event->pt, cgroup_event_ptable_queue_proc); | 6125 | init_poll_funcptr(&event->pt, memcg_event_ptable_queue_proc); |
6111 | init_waitqueue_func_entry(&event->wait, cgroup_event_wake); | 6126 | init_waitqueue_func_entry(&event->wait, memcg_event_wake); |
6112 | INIT_WORK(&event->remove, cgroup_event_remove); | 6127 | INIT_WORK(&event->remove, memcg_event_remove); |
6113 | 6128 | ||
6114 | efile = fdget(efd); | 6129 | efile = fdget(efd); |
6115 | if (!efile.file) { | 6130 | if (!efile.file) { |
@@ -6140,6 +6155,8 @@ static int cgroup_write_event_control(struct cgroup_subsys_state *css, | |||
6140 | * to be done via struct cftype but cgroup core no longer knows | 6155 | * to be done via struct cftype but cgroup core no longer knows |
6141 | * about these events. The following is crude but the whole thing | 6156 | * about these events. The following is crude but the whole thing |
6142 | * is for compatibility anyway. | 6157 | * is for compatibility anyway. |
6158 | * | ||
6159 | * DO NOT ADD NEW FILES. | ||
6143 | */ | 6160 | */ |
6144 | name = cfile.file->f_dentry->d_name.name; | 6161 | name = cfile.file->f_dentry->d_name.name; |
6145 | 6162 | ||
@@ -6251,8 +6268,8 @@ static struct cftype mem_cgroup_files[] = { | |||
6251 | .read_u64 = mem_cgroup_hierarchy_read, | 6268 | .read_u64 = mem_cgroup_hierarchy_read, |
6252 | }, | 6269 | }, |
6253 | { | 6270 | { |
6254 | .name = "cgroup.event_control", | 6271 | .name = "cgroup.event_control", /* XXX: for compat */ |
6255 | .write_string = cgroup_write_event_control, | 6272 | .write_string = memcg_write_event_control, |
6256 | .flags = CFTYPE_NO_PREFIX, | 6273 | .flags = CFTYPE_NO_PREFIX, |
6257 | .mode = S_IWUGO, | 6274 | .mode = S_IWUGO, |
6258 | }, | 6275 | }, |
@@ -6585,7 +6602,7 @@ static void mem_cgroup_invalidate_reclaim_iterators(struct mem_cgroup *memcg) | |||
6585 | static void mem_cgroup_css_offline(struct cgroup_subsys_state *css) | 6602 | static void mem_cgroup_css_offline(struct cgroup_subsys_state *css) |
6586 | { | 6603 | { |
6587 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); | 6604 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
6588 | struct cgroup_event *event, *tmp; | 6605 | struct mem_cgroup_event *event, *tmp; |
6589 | 6606 | ||
6590 | /* | 6607 | /* |
6591 | * Unregister events and notify userspace. | 6608 | * Unregister events and notify userspace. |