aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
authorPaul Menage <menage@google.com>2008-07-25 04:47:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:36 -0400
commit6379c106152388f7ea45d6dda63edda0e9181fc8 (patch)
treead38aad4eb0f2b4431ff15ec85c3e3aea99f7207 /kernel/cgroup.c
parent84eea842886ac35020be6043e04748ed22014359 (diff)
cgroup files: move notify_on_release file to separate write handler
This patch moves the write handler for the cgroups notify_on_release file into a separate handler. This handler requires no cgroups locking since it relies on atomic bitops for synchronization. Signed-off-by: Paul Menage <menage@google.com> Cc: Paul Jackson <pj@sgi.com> Cc: Pavel Emelyanov <xemul@openvz.org> Cc: Balbir Singh <balbir@in.ibm.com> Cc: Serge Hallyn <serue@us.ibm.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r--kernel/cgroup.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index a14122ecaa5e..d597d3015786 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1474,13 +1474,6 @@ static ssize_t cgroup_common_file_write(struct cgroup *cgrp,
1474 case FILE_TASKLIST: 1474 case FILE_TASKLIST:
1475 retval = attach_task_by_pid(cgrp, buffer); 1475 retval = attach_task_by_pid(cgrp, buffer);
1476 break; 1476 break;
1477 case FILE_NOTIFY_ON_RELEASE:
1478 clear_bit(CGRP_RELEASABLE, &cgrp->flags);
1479 if (simple_strtoul(buffer, NULL, 10) != 0)
1480 set_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
1481 else
1482 clear_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
1483 break;
1484 default: 1477 default:
1485 retval = -EINVAL; 1478 retval = -EINVAL;
1486 goto out2; 1479 goto out2;
@@ -2252,6 +2245,18 @@ static u64 cgroup_read_notify_on_release(struct cgroup *cgrp,
2252 return notify_on_release(cgrp); 2245 return notify_on_release(cgrp);
2253} 2246}
2254 2247
2248static int cgroup_write_notify_on_release(struct cgroup *cgrp,
2249 struct cftype *cft,
2250 u64 val)
2251{
2252 clear_bit(CGRP_RELEASABLE, &cgrp->flags);
2253 if (val)
2254 set_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
2255 else
2256 clear_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
2257 return 0;
2258}
2259
2255/* 2260/*
2256 * for the common functions, 'private' gives the type of file 2261 * for the common functions, 'private' gives the type of file
2257 */ 2262 */
@@ -2268,7 +2273,7 @@ static struct cftype files[] = {
2268 { 2273 {
2269 .name = "notify_on_release", 2274 .name = "notify_on_release",
2270 .read_u64 = cgroup_read_notify_on_release, 2275 .read_u64 = cgroup_read_notify_on_release,
2271 .write = cgroup_common_file_write, 2276 .write_u64 = cgroup_write_notify_on_release,
2272 .private = FILE_NOTIFY_ON_RELEASE, 2277 .private = FILE_NOTIFY_ON_RELEASE,
2273 }, 2278 },
2274}; 2279};