diff options
author | Tejun Heo <tj@kernel.org> | 2014-05-13 12:16:21 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-05-13 12:16:21 -0400 |
commit | 6770c64e5c8da4705d1f0973bdeb5c2bf4f3a404 (patch) | |
tree | 29e16383df94d4a31f6fec2f49f5ae84c369f911 /net | |
parent | 451af504df0c62f695a69b83c250486e77c66378 (diff) |
cgroup: replace cftype->trigger() with cftype->write()
cftype->trigger() is pointless. It's trivial to ignore the input
buffer from a regular ->write() operation. Convert all ->trigger()
users to ->write() and remove ->trigger().
This patch doesn't introduce any visible behavior changes.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/tcp_memcontrol.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/net/ipv4/tcp_memcontrol.c b/net/ipv4/tcp_memcontrol.c index 841fd3fa937a..f7a2ec3ac584 100644 --- a/net/ipv4/tcp_memcontrol.c +++ b/net/ipv4/tcp_memcontrol.c | |||
@@ -170,17 +170,18 @@ static u64 tcp_cgroup_read(struct cgroup_subsys_state *css, struct cftype *cft) | |||
170 | return val; | 170 | return val; |
171 | } | 171 | } |
172 | 172 | ||
173 | static int tcp_cgroup_reset(struct cgroup_subsys_state *css, unsigned int event) | 173 | static ssize_t tcp_cgroup_reset(struct kernfs_open_file *of, |
174 | char *buf, size_t nbytes, loff_t off) | ||
174 | { | 175 | { |
175 | struct mem_cgroup *memcg; | 176 | struct mem_cgroup *memcg; |
176 | struct cg_proto *cg_proto; | 177 | struct cg_proto *cg_proto; |
177 | 178 | ||
178 | memcg = mem_cgroup_from_css(css); | 179 | memcg = mem_cgroup_from_css(of_css(of)); |
179 | cg_proto = tcp_prot.proto_cgroup(memcg); | 180 | cg_proto = tcp_prot.proto_cgroup(memcg); |
180 | if (!cg_proto) | 181 | if (!cg_proto) |
181 | return 0; | 182 | return nbytes; |
182 | 183 | ||
183 | switch (event) { | 184 | switch (of_cft(of)->private) { |
184 | case RES_MAX_USAGE: | 185 | case RES_MAX_USAGE: |
185 | res_counter_reset_max(&cg_proto->memory_allocated); | 186 | res_counter_reset_max(&cg_proto->memory_allocated); |
186 | break; | 187 | break; |
@@ -189,7 +190,7 @@ static int tcp_cgroup_reset(struct cgroup_subsys_state *css, unsigned int event) | |||
189 | break; | 190 | break; |
190 | } | 191 | } |
191 | 192 | ||
192 | return 0; | 193 | return nbytes; |
193 | } | 194 | } |
194 | 195 | ||
195 | static struct cftype tcp_files[] = { | 196 | static struct cftype tcp_files[] = { |
@@ -207,13 +208,13 @@ static struct cftype tcp_files[] = { | |||
207 | { | 208 | { |
208 | .name = "kmem.tcp.failcnt", | 209 | .name = "kmem.tcp.failcnt", |
209 | .private = RES_FAILCNT, | 210 | .private = RES_FAILCNT, |
210 | .trigger = tcp_cgroup_reset, | 211 | .write = tcp_cgroup_reset, |
211 | .read_u64 = tcp_cgroup_read, | 212 | .read_u64 = tcp_cgroup_read, |
212 | }, | 213 | }, |
213 | { | 214 | { |
214 | .name = "kmem.tcp.max_usage_in_bytes", | 215 | .name = "kmem.tcp.max_usage_in_bytes", |
215 | .private = RES_MAX_USAGE, | 216 | .private = RES_MAX_USAGE, |
216 | .trigger = tcp_cgroup_reset, | 217 | .write = tcp_cgroup_reset, |
217 | .read_u64 = tcp_cgroup_read, | 218 | .read_u64 = tcp_cgroup_read, |
218 | }, | 219 | }, |
219 | { } /* terminate */ | 220 | { } /* terminate */ |