Commit 3116f0e3df0a67ad56f15dd4c5f6cefb04bb4a98

Authored by Paul Menage
Committed by Linus Torvalds
1 parent c27e8818a0

CGroup API files: move "releasable" to cgroup_debug subsystem

The "releasable" control file provided by the cgroup framework exports the
state of a per-cgroup flag that's related to the notify-on-release feature.
This isn't really generally useful, unless you're trying to debug this
particular feature of cgroups.

This patch moves the "releasable" file to the cgroup_debug subsystem.

Signed-off-by: Paul Menage <menage@google.com>
Cc: "Li Zefan" <lizf@cn.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Paul Jackson <pj@sgi.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "YAMAMOTO Takashi" <yamamoto@valinux.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 3 changed files with 22 additions and 24 deletions Side-by-side Diff

include/linux/cgroup.h
... ... @@ -88,6 +88,17 @@
88 88 __css_put(css);
89 89 }
90 90  
  91 +/* bits in struct cgroup flags field */
  92 +enum {
  93 + /* Control Group is dead */
  94 + CGRP_REMOVED,
  95 + /* Control Group has previously had a child cgroup or a task,
  96 + * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) */
  97 + CGRP_RELEASABLE,
  98 + /* Control Group requires release notifications to userspace */
  99 + CGRP_NOTIFY_ON_RELEASE,
  100 +};
  101 +
91 102 struct cgroup {
92 103 unsigned long flags; /* "unsigned long" so bitops work */
93 104  
... ... @@ -119,17 +119,6 @@
119 119 */
120 120 static int need_forkexit_callback;
121 121  
122   -/* bits in struct cgroup flags field */
123   -enum {
124   - /* Control Group is dead */
125   - CGRP_REMOVED,
126   - /* Control Group has previously had a child cgroup or a task,
127   - * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) */
128   - CGRP_RELEASABLE,
129   - /* Control Group requires release notifications to userspace */
130   - CGRP_NOTIFY_ON_RELEASE,
131   -};
132   -
133 122 /* convenient tests for these bits */
134 123 inline int cgroup_is_removed(const struct cgroup *cgrp)
135 124 {
... ... @@ -1307,7 +1296,6 @@
1307 1296 FILE_DIR,
1308 1297 FILE_TASKLIST,
1309 1298 FILE_NOTIFY_ON_RELEASE,
1310   - FILE_RELEASABLE,
1311 1299 FILE_RELEASE_AGENT,
1312 1300 };
1313 1301  
... ... @@ -2186,11 +2174,6 @@
2186 2174 return notify_on_release(cgrp);
2187 2175 }
2188 2176  
2189   -static u64 cgroup_read_releasable(struct cgroup *cgrp, struct cftype *cft)
2190   -{
2191   - return test_bit(CGRP_RELEASABLE, &cgrp->flags);
2192   -}
2193   -
2194 2177 /*
2195 2178 * for the common functions, 'private' gives the type of file
2196 2179 */
... ... @@ -2210,12 +2193,6 @@
2210 2193 .write = cgroup_common_file_write,
2211 2194 .private = FILE_NOTIFY_ON_RELEASE,
2212 2195 },
2213   -
2214   - {
2215   - .name = "releasable",
2216   - .read_u64 = cgroup_read_releasable,
2217   - .private = FILE_RELEASABLE,
2218   - }
2219 2196 };
2220 2197  
2221 2198 static struct cftype cft_release_agent = {
kernel/cgroup_debug.c
1 1 /*
2   - * kernel/ccontainer_debug.c - Example cgroup subsystem that
  2 + * kernel/cgroup_debug.c - Example cgroup subsystem that
3 3 * exposes debug info
4 4 *
5 5 * Copyright (C) Google Inc, 2007
... ... @@ -62,6 +62,11 @@
62 62 return count;
63 63 }
64 64  
  65 +static u64 releasable_read(struct cgroup *cgrp, struct cftype *cft)
  66 +{
  67 + return test_bit(CGRP_RELEASABLE, &cgrp->flags);
  68 +}
  69 +
65 70 static struct cftype files[] = {
66 71 {
67 72 .name = "cgroup_refcount",
... ... @@ -81,6 +86,11 @@
81 86 .name = "current_css_set_refcount",
82 87 .read_u64 = current_css_set_refcount_read,
83 88 },
  89 +
  90 + {
  91 + .name = "releasable",
  92 + .read_u64 = releasable_read,
  93 + }
84 94 };
85 95  
86 96 static int debug_populate(struct cgroup_subsys *ss, struct cgroup *cont)