LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files
@ 2008-02-23 22:47 menage
  2008-02-23 22:47 ` [PATCH 01/10] CGroup API files: Rename read/write_uint methods to read_write_u64 menage
                   ` (10 more replies)
  0 siblings, 11 replies; 17+ messages in thread
From: menage @ 2008-02-23 22:47 UTC (permalink / raw)
  To: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki, YAMAMOTO Takashi
  Cc: linux-kernel, containers

This patchset is a roll-up of the non-contraversial items of the
various patches that I've sent out recently, fixed according to the
feedback received.

In summary they are:

- general rename of read_uint/write_uint to read_u64/write_u64

- use these methods for cpusets and memory controller files

- add a read_map cgroup file method, and use it in the memory
  controller

- move the "releasable" control file to the debug subsystem

- make the debug subsystem config option default to "n"

The only user-visible changes are the movement of the "releasable"
file and the fact that some write_u64()-based control files are now
more forgiving of additional whitespace at the end of their input.

Signed-off-by: Paul Menage <menage@google.com>

--

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 01/10] CGroup API files: Rename read/write_uint methods to read_write_u64
  2008-02-23 22:47 [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files menage
@ 2008-02-23 22:47 ` menage
  2008-02-23 22:47 ` [PATCH 02/10] CGroup API files: Add res_counter_read_u64() menage
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: menage @ 2008-02-23 22:47 UTC (permalink / raw)
  To: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki, YAMAMOTO Takashi
  Cc: linux-kernel, containers

[-- Attachment #1: rename_uint_to_u64.patch --]
[-- Type: text/plain, Size: 7265 bytes --]

Several people have justifiably complained that the "_uint" suffix is
inappropriate for functions that handle u64 values, so this patch just
renames all these functions and their users to have the suffic _u64.

Signed-off-by: Paul Menage <menage@google.com>

---
 include/linux/cgroup.h |    8 ++++----
 kernel/cgroup.c        |   32 ++++++++++++++++----------------
 kernel/cgroup_debug.c  |    8 ++++----
 kernel/sched.c         |   18 +++++++++---------
 4 files changed, 33 insertions(+), 33 deletions(-)

Index: cgroup-2.6.25-rc2-mm1/include/linux/cgroup.h
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/include/linux/cgroup.h
+++ cgroup-2.6.25-rc2-mm1/include/linux/cgroup.h
@@ -190,20 +190,20 @@ struct cftype {
 			 struct file *file,
 			 char __user *buf, size_t nbytes, loff_t *ppos);
 	/*
-	 * read_uint() is a shortcut for the common case of returning a
+	 * read_u64() is a shortcut for the common case of returning a
 	 * single integer. Use it in place of read()
 	 */
-	u64 (*read_uint) (struct cgroup *cont, struct cftype *cft);
+	u64 (*read_u64) (struct cgroup *cont, struct cftype *cft);
 	ssize_t (*write) (struct cgroup *cont, struct cftype *cft,
 			  struct file *file,
 			  const char __user *buf, size_t nbytes, loff_t *ppos);
 
 	/*
-	 * write_uint() is a shortcut for the common case of accepting
+	 * write_u64() is a shortcut for the common case of accepting
 	 * a single integer (as parsed by simple_strtoull) from
 	 * userspace. Use in place of write(); return 0 or error.
 	 */
-	int (*write_uint) (struct cgroup *cont, struct cftype *cft, u64 val);
+	int (*write_u64) (struct cgroup *cont, struct cftype *cft, u64 val);
 
 	int (*release) (struct inode *inode, struct file *file);
 };
Index: cgroup-2.6.25-rc2-mm1/kernel/cgroup.c
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/kernel/cgroup.c
+++ cgroup-2.6.25-rc2-mm1/kernel/cgroup.c
@@ -1303,10 +1303,10 @@ enum cgroup_filetype {
 	FILE_RELEASE_AGENT,
 };
 
-static ssize_t cgroup_write_uint(struct cgroup *cgrp, struct cftype *cft,
-				 struct file *file,
-				 const char __user *userbuf,
-				 size_t nbytes, loff_t *unused_ppos)
+static ssize_t cgroup_write_u64(struct cgroup *cgrp, struct cftype *cft,
+				struct file *file,
+				const char __user *userbuf,
+				size_t nbytes, loff_t *unused_ppos)
 {
 	char buffer[64];
 	int retval = 0;
@@ -1330,7 +1330,7 @@ static ssize_t cgroup_write_uint(struct 
 		return -EINVAL;
 
 	/* Pass to subsystem */
-	retval = cft->write_uint(cgrp, cft, val);
+	retval = cft->write_u64(cgrp, cft, val);
 	if (!retval)
 		retval = nbytes;
 	return retval;
@@ -1411,18 +1411,18 @@ static ssize_t cgroup_file_write(struct 
 		return -ENODEV;
 	if (cft->write)
 		return cft->write(cgrp, cft, file, buf, nbytes, ppos);
-	if (cft->write_uint)
-		return cgroup_write_uint(cgrp, cft, file, buf, nbytes, ppos);
+	if (cft->write_u64)
+		return cgroup_write_u64(cgrp, cft, file, buf, nbytes, ppos);
 	return -EINVAL;
 }
 
-static ssize_t cgroup_read_uint(struct cgroup *cgrp, struct cftype *cft,
-				   struct file *file,
-				   char __user *buf, size_t nbytes,
-				   loff_t *ppos)
+static ssize_t cgroup_read_u64(struct cgroup *cgrp, struct cftype *cft,
+			       struct file *file,
+			       char __user *buf, size_t nbytes,
+			       loff_t *ppos)
 {
 	char tmp[64];
-	u64 val = cft->read_uint(cgrp, cft);
+	u64 val = cft->read_u64(cgrp, cft);
 	int len = sprintf(tmp, "%llu\n", (unsigned long long) val);
 
 	return simple_read_from_buffer(buf, nbytes, ppos, tmp, len);
@@ -1482,8 +1482,8 @@ static ssize_t cgroup_file_read(struct f
 
 	if (cft->read)
 		return cft->read(cgrp, cft, file, buf, nbytes, ppos);
-	if (cft->read_uint)
-		return cgroup_read_uint(cgrp, cft, file, buf, nbytes, ppos);
+	if (cft->read_u64)
+		return cgroup_read_u64(cgrp, cft, file, buf, nbytes, ppos);
 	return -EINVAL;
 }
 
@@ -2141,14 +2141,14 @@ static struct cftype files[] = {
 
 	{
 		.name = "notify_on_release",
-		.read_uint = cgroup_read_notify_on_release,
+		.read_u64 = cgroup_read_notify_on_release,
 		.write = cgroup_common_file_write,
 		.private = FILE_NOTIFY_ON_RELEASE,
 	},
 
 	{
 		.name = "releasable",
-		.read_uint = cgroup_read_releasable,
+		.read_u64 = cgroup_read_releasable,
 		.private = FILE_RELEASABLE,
 	}
 };
Index: cgroup-2.6.25-rc2-mm1/kernel/cgroup_debug.c
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/kernel/cgroup_debug.c
+++ cgroup-2.6.25-rc2-mm1/kernel/cgroup_debug.c
@@ -65,21 +65,21 @@ static u64 current_css_set_refcount_read
 static struct cftype files[] =  {
 	{
 		.name = "cgroup_refcount",
-		.read_uint = cgroup_refcount_read,
+		.read_u64 = cgroup_refcount_read,
 	},
 	{
 		.name = "taskcount",
-		.read_uint = taskcount_read,
+		.read_u64 = taskcount_read,
 	},
 
 	{
 		.name = "current_css_set",
-		.read_uint = current_css_set_read,
+		.read_u64 = current_css_set_read,
 	},
 
 	{
 		.name = "current_css_set_refcount",
-		.read_uint = current_css_set_refcount_read,
+		.read_u64 = current_css_set_refcount_read,
 	},
 };
 
Index: cgroup-2.6.25-rc2-mm1/kernel/sched.c
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/kernel/sched.c
+++ cgroup-2.6.25-rc2-mm1/kernel/sched.c
@@ -8286,13 +8286,13 @@ cpu_cgroup_attach(struct cgroup_subsys *
 }
 
 #ifdef CONFIG_FAIR_GROUP_SCHED
-static int cpu_shares_write_uint(struct cgroup *cgrp, struct cftype *cftype,
+static int cpu_shares_write_u64(struct cgroup *cgrp, struct cftype *cftype,
 				u64 shareval)
 {
 	return sched_group_set_shares(cgroup_tg(cgrp), shareval);
 }
 
-static u64 cpu_shares_read_uint(struct cgroup *cgrp, struct cftype *cft)
+static u64 cpu_shares_read_u64(struct cgroup *cgrp, struct cftype *cft)
 {
 	struct task_group *tg = cgroup_tg(cgrp);
 
@@ -8346,13 +8346,13 @@ static ssize_t cpu_rt_runtime_read(struc
 	return simple_read_from_buffer(buf, nbytes, ppos, tmp, len);
 }
 
-static int cpu_rt_period_write_uint(struct cgroup *cgrp, struct cftype *cftype,
+static int cpu_rt_period_write_u64(struct cgroup *cgrp, struct cftype *cftype,
 		u64 rt_period_us)
 {
 	return sched_group_set_rt_period(cgroup_tg(cgrp), rt_period_us);
 }
 
-static u64 cpu_rt_period_read_uint(struct cgroup *cgrp, struct cftype *cft)
+static u64 cpu_rt_period_read_u64(struct cgroup *cgrp, struct cftype *cft)
 {
 	return sched_group_rt_period(cgroup_tg(cgrp));
 }
@@ -8362,8 +8362,8 @@ static struct cftype cpu_files[] = {
 #ifdef CONFIG_FAIR_GROUP_SCHED
 	{
 		.name = "shares",
-		.read_uint = cpu_shares_read_uint,
-		.write_uint = cpu_shares_write_uint,
+		.read_u64 = cpu_shares_read_u64,
+		.write_u64 = cpu_shares_write_u64,
 	},
 #endif
 #ifdef CONFIG_RT_GROUP_SCHED
@@ -8374,8 +8374,8 @@ static struct cftype cpu_files[] = {
 	},
 	{
 		.name = "rt_period_us",
-		.read_uint = cpu_rt_period_read_uint,
-		.write_uint = cpu_rt_period_write_uint,
+		.read_u64 = cpu_rt_period_read_u64,
+		.write_u64 = cpu_rt_period_write_u64,
 	},
 #endif
 };
@@ -8483,7 +8483,7 @@ static u64 cpuusage_read(struct cgroup *
 static struct cftype files[] = {
 	{
 		.name = "usage",
-		.read_uint = cpuusage_read,
+		.read_u64 = cpuusage_read,
 	},
 };
 

--

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 02/10] CGroup API files: Add res_counter_read_u64()
  2008-02-23 22:47 [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files menage
  2008-02-23 22:47 ` [PATCH 01/10] CGroup API files: Rename read/write_uint methods to read_write_u64 menage
@ 2008-02-23 22:47 ` menage
  2008-02-23 22:47 ` [PATCH 03/10] CGroup API files: Use read_u64 in memory controller menage
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: menage @ 2008-02-23 22:47 UTC (permalink / raw)
  To: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki, YAMAMOTO Takashi
  Cc: linux-kernel, containers

[-- Attachment #1: resource_counter_read_uint.patch --]
[-- Type: text/plain, Size: 1811 bytes --]

Adds a function for returning the value of a resource counter member,
in a form suitable for use in a cgroup read_u64 control file method.

Signed-off-by: Paul Menage <menage@google.com>

---
 include/linux/res_counter.h |    5 ++++-
 kernel/res_counter.c        |    5 +++++
 2 files changed, 9 insertions(+), 1 deletion(-)

Index: cgroup-2.6.25-rc2-mm1/include/linux/res_counter.h
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/include/linux/res_counter.h
+++ cgroup-2.6.25-rc2-mm1/include/linux/res_counter.h
@@ -39,8 +39,9 @@ struct res_counter {
 	spinlock_t lock;
 };
 
-/*
+/**
  * Helpers to interact with userspace
+ * res_counter_read_u64() - returns the value of the specified member.
  * res_counter_read/_write - put/get the specified fields from the
  * res_counter struct to/from the user
  *
@@ -51,6 +52,8 @@ struct res_counter {
  * @pos:     and the offset.
  */
 
+u64 res_counter_read_u64(struct res_counter *counter, int member);
+
 ssize_t res_counter_read(struct res_counter *counter, int member,
 		const char __user *buf, size_t nbytes, loff_t *pos,
 		int (*read_strategy)(unsigned long long val, char *s));
Index: cgroup-2.6.25-rc2-mm1/kernel/res_counter.c
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/kernel/res_counter.c
+++ cgroup-2.6.25-rc2-mm1/kernel/res_counter.c
@@ -92,6 +92,11 @@ ssize_t res_counter_read(struct res_coun
 			pos, buf, s - buf);
 }
 
+u64 res_counter_read_u64(struct res_counter *counter, int member)
+{
+	return *res_counter_member(counter, member);
+}
+
 ssize_t res_counter_write(struct res_counter *counter, int member,
 		const char __user *userbuf, size_t nbytes, loff_t *pos,
 		int (*write_strategy)(char *st_buf, unsigned long long *val))

--

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 03/10] CGroup API files: Use read_u64 in memory controller
  2008-02-23 22:47 [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files menage
  2008-02-23 22:47 ` [PATCH 01/10] CGroup API files: Rename read/write_uint methods to read_write_u64 menage
  2008-02-23 22:47 ` [PATCH 02/10] CGroup API files: Add res_counter_read_u64() menage
@ 2008-02-23 22:47 ` menage
  2008-02-23 22:47 ` [PATCH 04/10] CGroup API files: Strip all trailing whitespace in cgroup_write_u64 menage
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: menage @ 2008-02-23 22:47 UTC (permalink / raw)
  To: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki, YAMAMOTO Takashi
  Cc: linux-kernel, containers

[-- Attachment #1: memcontrol_use_res_counter_read_uint.patch --]
[-- Type: text/plain, Size: 1559 bytes --]

Update the memory controller to use read_u64 for its
limit/usage/failcnt control files, calling the new
res_counter_read_u64() function.

Signed-off-by: Paul Menage <menage@google.com>

---
 mm/memcontrol.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

Index: cgroup-2.6.25-rc2-mm1/mm/memcontrol.c
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/mm/memcontrol.c
+++ cgroup-2.6.25-rc2-mm1/mm/memcontrol.c
@@ -922,13 +922,10 @@ int mem_cgroup_write_strategy(char *buf,
 	return 0;
 }
 
-static ssize_t mem_cgroup_read(struct cgroup *cont,
-			struct cftype *cft, struct file *file,
-			char __user *userbuf, size_t nbytes, loff_t *ppos)
+static u64 mem_cgroup_read(struct cgroup *cont, struct cftype *cft)
 {
-	return res_counter_read(&mem_cgroup_from_cont(cont)->res,
-				cft->private, userbuf, nbytes, ppos,
-				NULL);
+	return res_counter_read_u64(&mem_cgroup_from_cont(cont)->res,
+				    cft->private);
 }
 
 static ssize_t mem_cgroup_write(struct cgroup *cont, struct cftype *cft,
@@ -1024,18 +1021,18 @@ static struct cftype mem_cgroup_files[] 
 	{
 		.name = "usage_in_bytes",
 		.private = RES_USAGE,
-		.read = mem_cgroup_read,
+		.read_u64 = mem_cgroup_read,
 	},
 	{
 		.name = "limit_in_bytes",
 		.private = RES_LIMIT,
 		.write = mem_cgroup_write,
-		.read = mem_cgroup_read,
+		.read_u64 = mem_cgroup_read,
 	},
 	{
 		.name = "failcnt",
 		.private = RES_FAILCNT,
-		.read = mem_cgroup_read,
+		.read_u64 = mem_cgroup_read,
 	},
 	{
 		.name = "force_empty",

--

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 04/10] CGroup API files: Strip all trailing whitespace in cgroup_write_u64
  2008-02-23 22:47 [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files menage
                   ` (2 preceding siblings ...)
  2008-02-23 22:47 ` [PATCH 03/10] CGroup API files: Use read_u64 in memory controller menage
@ 2008-02-23 22:47 ` menage
  2008-02-23 22:47 ` [PATCH 05/10] CGroup API files: Update cpusets to use cgroup structured file API menage
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: menage @ 2008-02-23 22:47 UTC (permalink / raw)
  To: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki, YAMAMOTO Takashi
  Cc: linux-kernel, containers

[-- Attachment #1: cgroup_write_uint_strstrip.patch --]
[-- Type: text/plain, Size: 786 bytes --]

This removes the need for people to remember to pass the -n flag to
echo when writing values to cgroup control files.

Signed-off-by: Paul Menage <menage@google.com>

---
 kernel/cgroup.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Index: cgroup-2.6.25-rc2-mm1/kernel/cgroup.c
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/kernel/cgroup.c
+++ cgroup-2.6.25-rc2-mm1/kernel/cgroup.c
@@ -1321,10 +1321,7 @@ static ssize_t cgroup_write_u64(struct c
 		return -EFAULT;
 
 	buffer[nbytes] = 0;     /* nul-terminate */
-
-	/* strip newline if necessary */
-	if (nbytes && (buffer[nbytes-1] == '\n'))
-		buffer[nbytes-1] = 0;
+	strstrip(buffer);
 	val = simple_strtoull(buffer, &end, 0);
 	if (*end)
 		return -EINVAL;

--

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 05/10] CGroup API files: Update cpusets to use cgroup structured file API
  2008-02-23 22:47 [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files menage
                   ` (3 preceding siblings ...)
  2008-02-23 22:47 ` [PATCH 04/10] CGroup API files: Strip all trailing whitespace in cgroup_write_u64 menage
@ 2008-02-23 22:47 ` menage
  2008-02-27  0:54   ` Li Zefan
  2008-02-23 22:47 ` [PATCH 06/10] CGroup API files: Add cgroup map data type menage
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 17+ messages in thread
From: menage @ 2008-02-23 22:47 UTC (permalink / raw)
  To: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki, YAMAMOTO Takashi
  Cc: linux-kernel, containers

[-- Attachment #1: cpuset_files.patch --]
[-- Type: text/plain, Size: 7557 bytes --]

Many of the cpusets control files are simple integer values, which
don't require the overhead of memory allocations for reads and writes.

Move the handlers for these control files into cpuset_read_u64() and
cpuset_write_u64().

Signed-off-by: Paul Menage <menage@google.com>

---
 kernel/cpuset.c |  155 +++++++++++++++++++++++++++++---------------------------
 1 file changed, 81 insertions(+), 74 deletions(-)

Index: cgroup-2.6.25-rc2-mm1/kernel/cpuset.c
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/kernel/cpuset.c
+++ cgroup-2.6.25-rc2-mm1/kernel/cpuset.c
@@ -999,19 +999,6 @@ int current_cpuset_is_being_rebound(void
 }
 
 /*
- * Call with cgroup_mutex held.
- */
-
-static int update_memory_pressure_enabled(struct cpuset *cs, char *buf)
-{
-	if (simple_strtoul(buf, NULL, 10) != 0)
-		cpuset_memory_pressure_enabled = 1;
-	else
-		cpuset_memory_pressure_enabled = 0;
-	return 0;
-}
-
-/*
  * update_flag - read a 0 or a 1 in a file and update associated flag
  * bit:	the bit to update (CS_CPU_EXCLUSIVE, CS_MEM_EXCLUSIVE,
  *				CS_SCHED_LOAD_BALANCE,
@@ -1023,15 +1010,13 @@ static int update_memory_pressure_enable
  * Call with cgroup_mutex held.
  */
 
-static int update_flag(cpuset_flagbits_t bit, struct cpuset *cs, char *buf)
+static int update_flag(cpuset_flagbits_t bit, struct cpuset *cs,
+		       int turning_on)
 {
-	int turning_on;
 	struct cpuset trialcs;
 	int err;
 	int cpus_nonempty, balance_flag_changed;
 
-	turning_on = (simple_strtoul(buf, NULL, 10) != 0);
-
 	trialcs = *cs;
 	if (turning_on)
 		set_bit(bit, &trialcs.flags);
@@ -1247,43 +1232,65 @@ static ssize_t cpuset_common_file_write(
 	case FILE_MEMLIST:
 		retval = update_nodemask(cs, buffer);
 		break;
+	default:
+		retval = -EINVAL;
+		goto out2;
+	}
+
+	if (retval == 0)
+		retval = nbytes;
+out2:
+	cgroup_unlock();
+out1:
+	kfree(buffer);
+	return retval;
+}
+
+static int cpuset_write_u64(struct cgroup *cgrp, struct cftype *cft, u64 val)
+{
+	int retval = 0;
+	struct cpuset *cs = cgroup_cs(cgrp);
+	cpuset_filetype_t type = cft->private;
+
+	cgroup_lock();
+
+	if (cgroup_is_removed(cgrp)) {
+		cgroup_unlock();
+		return -ENODEV;
+	}
+
+	switch (type) {
 	case FILE_CPU_EXCLUSIVE:
-		retval = update_flag(CS_CPU_EXCLUSIVE, cs, buffer);
+		retval = update_flag(CS_CPU_EXCLUSIVE, cs, val);
 		break;
 	case FILE_MEM_EXCLUSIVE:
-		retval = update_flag(CS_MEM_EXCLUSIVE, cs, buffer);
+		retval = update_flag(CS_MEM_EXCLUSIVE, cs, val);
 		break;
 	case FILE_SCHED_LOAD_BALANCE:
-		retval = update_flag(CS_SCHED_LOAD_BALANCE, cs, buffer);
+		retval = update_flag(CS_SCHED_LOAD_BALANCE, cs, val);
 		break;
 	case FILE_MEMORY_MIGRATE:
-		retval = update_flag(CS_MEMORY_MIGRATE, cs, buffer);
+		retval = update_flag(CS_MEMORY_MIGRATE, cs, val);
 		break;
 	case FILE_MEMORY_PRESSURE_ENABLED:
-		retval = update_memory_pressure_enabled(cs, buffer);
+		cpuset_memory_pressure_enabled = !!val;
 		break;
 	case FILE_MEMORY_PRESSURE:
 		retval = -EACCES;
 		break;
 	case FILE_SPREAD_PAGE:
-		retval = update_flag(CS_SPREAD_PAGE, cs, buffer);
+		retval = update_flag(CS_SPREAD_PAGE, cs, val);
 		cs->mems_generation = cpuset_mems_generation++;
 		break;
 	case FILE_SPREAD_SLAB:
-		retval = update_flag(CS_SPREAD_SLAB, cs, buffer);
+		retval = update_flag(CS_SPREAD_SLAB, cs, val);
 		cs->mems_generation = cpuset_mems_generation++;
 		break;
 	default:
 		retval = -EINVAL;
-		goto out2;
+		break;
 	}
-
-	if (retval == 0)
-		retval = nbytes;
-out2:
 	cgroup_unlock();
-out1:
-	kfree(buffer);
 	return retval;
 }
 
@@ -1345,30 +1352,6 @@ static ssize_t cpuset_common_file_read(s
 	case FILE_MEMLIST:
 		s += cpuset_sprintf_memlist(s, cs);
 		break;
-	case FILE_CPU_EXCLUSIVE:
-		*s++ = is_cpu_exclusive(cs) ? '1' : '0';
-		break;
-	case FILE_MEM_EXCLUSIVE:
-		*s++ = is_mem_exclusive(cs) ? '1' : '0';
-		break;
-	case FILE_SCHED_LOAD_BALANCE:
-		*s++ = is_sched_load_balance(cs) ? '1' : '0';
-		break;
-	case FILE_MEMORY_MIGRATE:
-		*s++ = is_memory_migrate(cs) ? '1' : '0';
-		break;
-	case FILE_MEMORY_PRESSURE_ENABLED:
-		*s++ = cpuset_memory_pressure_enabled ? '1' : '0';
-		break;
-	case FILE_MEMORY_PRESSURE:
-		s += sprintf(s, "%d", fmeter_getrate(&cs->fmeter));
-		break;
-	case FILE_SPREAD_PAGE:
-		*s++ = is_spread_page(cs) ? '1' : '0';
-		break;
-	case FILE_SPREAD_SLAB:
-		*s++ = is_spread_slab(cs) ? '1' : '0';
-		break;
 	default:
 		retval = -EINVAL;
 		goto out;
@@ -1381,8 +1364,32 @@ out:
 	return retval;
 }
 
-
-
+static u64 cpuset_read_u64(struct cgroup *cont, struct cftype *cft)
+{
+	struct cpuset *cs = cgroup_cs(cont);
+	cpuset_filetype_t type = cft->private;
+	switch (type) {
+	case FILE_CPU_EXCLUSIVE:
+		return is_cpu_exclusive(cs);
+	case FILE_MEM_EXCLUSIVE:
+		return is_mem_exclusive(cs);
+	case FILE_SCHED_LOAD_BALANCE:
+		return is_sched_load_balance(cs);
+	case FILE_MEMORY_MIGRATE:
+		return is_memory_migrate(cs);
+	case FILE_MEMORY_PRESSURE_ENABLED:
+		return cpuset_memory_pressure_enabled;
+	case FILE_MEMORY_PRESSURE:
+		return fmeter_getrate(&cs->fmeter);
+		break;
+	case FILE_SPREAD_PAGE:
+		return is_spread_page(cs);
+	case FILE_SPREAD_SLAB:
+		return is_spread_slab(cs);
+	default:
+		BUG();
+	}
+}
 
 
 /*
@@ -1405,57 +1412,57 @@ static struct cftype cft_mems = {
 
 static struct cftype cft_cpu_exclusive = {
 	.name = "cpu_exclusive",
-	.read = cpuset_common_file_read,
-	.write = cpuset_common_file_write,
+	.read_u64 = cpuset_read_u64,
+	.write_u64 = cpuset_write_u64,
 	.private = FILE_CPU_EXCLUSIVE,
 };
 
 static struct cftype cft_mem_exclusive = {
 	.name = "mem_exclusive",
-	.read = cpuset_common_file_read,
-	.write = cpuset_common_file_write,
+	.read_u64 = cpuset_read_u64,
+	.write_u64 = cpuset_write_u64,
 	.private = FILE_MEM_EXCLUSIVE,
 };
 
 static struct cftype cft_sched_load_balance = {
 	.name = "sched_load_balance",
-	.read = cpuset_common_file_read,
-	.write = cpuset_common_file_write,
+	.read_u64 = cpuset_read_u64,
+	.write_u64 = cpuset_write_u64,
 	.private = FILE_SCHED_LOAD_BALANCE,
 };
 
 static struct cftype cft_memory_migrate = {
 	.name = "memory_migrate",
-	.read = cpuset_common_file_read,
-	.write = cpuset_common_file_write,
+	.read_u64 = cpuset_read_u64,
+	.write_u64 = cpuset_write_u64,
 	.private = FILE_MEMORY_MIGRATE,
 };
 
 static struct cftype cft_memory_pressure_enabled = {
 	.name = "memory_pressure_enabled",
-	.read = cpuset_common_file_read,
-	.write = cpuset_common_file_write,
+	.read_u64 = cpuset_read_u64,
+	.write_u64 = cpuset_write_u64,
 	.private = FILE_MEMORY_PRESSURE_ENABLED,
 };
 
 static struct cftype cft_memory_pressure = {
 	.name = "memory_pressure",
-	.read = cpuset_common_file_read,
-	.write = cpuset_common_file_write,
+	.read_u64 = cpuset_read_u64,
+	.write_u64 = cpuset_write_u64,
 	.private = FILE_MEMORY_PRESSURE,
 };
 
 static struct cftype cft_spread_page = {
 	.name = "memory_spread_page",
-	.read = cpuset_common_file_read,
-	.write = cpuset_common_file_write,
+	.read_u64 = cpuset_read_u64,
+	.write_u64 = cpuset_write_u64,
 	.private = FILE_SPREAD_PAGE,
 };
 
 static struct cftype cft_spread_slab = {
 	.name = "memory_spread_slab",
-	.read = cpuset_common_file_read,
-	.write = cpuset_common_file_write,
+	.read_u64 = cpuset_read_u64,
+	.write_u64 = cpuset_write_u64,
 	.private = FILE_SPREAD_SLAB,
 };
 
@@ -1584,7 +1591,7 @@ static void cpuset_destroy(struct cgroup
 	cpuset_update_task_memory_state();
 
 	if (is_sched_load_balance(cs))
-		update_flag(CS_SCHED_LOAD_BALANCE, cs, "0");
+		update_flag(CS_SCHED_LOAD_BALANCE, cs, 0);
 
 	number_of_cpusets--;
 	kfree(cs);

--

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 06/10] CGroup API files: Add cgroup map data type
  2008-02-23 22:47 [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files menage
                   ` (4 preceding siblings ...)
  2008-02-23 22:47 ` [PATCH 05/10] CGroup API files: Update cpusets to use cgroup structured file API menage
@ 2008-02-23 22:47 ` menage
  2008-02-23 22:47 ` [PATCH 07/10] CGroup API files: Use cgroup map for memcontrol stats file menage
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: menage @ 2008-02-23 22:47 UTC (permalink / raw)
  To: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki, YAMAMOTO Takashi
  Cc: linux-kernel, containers

[-- Attachment #1: cgroup_read_map.patch --]
[-- Type: text/plain, Size: 3592 bytes --]

Adds a new type of supported control file representation, a map from
strings to u64 values.

Each map entry is printed as a line in a similar format to
/proc/vmstat, i.e. "$key $value\n"

Signed-off-by: Paul Menage <menage@google.com>

---
 include/linux/cgroup.h |   19 +++++++++++++++++
 kernel/cgroup.c        |   53 ++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 71 insertions(+), 1 deletion(-)

Index: cgroup-2.6.25-rc2-mm1/include/linux/cgroup.h
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/include/linux/cgroup.h
+++ cgroup-2.6.25-rc2-mm1/include/linux/cgroup.h
@@ -166,6 +166,16 @@ struct css_set {
 
 };
 
+/*
+ * cgroup_map_cb is an abstract callback API for reporting map-valued
+ * control files
+ */
+
+struct cgroup_map_cb {
+	int (*fill)(struct cgroup_map_cb *cb, const char *key, u64 value);
+	void *state;
+};
+
 /* struct cftype:
  *
  * The files in the cgroup filesystem mostly have a very simple read/write
@@ -194,6 +204,15 @@ struct cftype {
 	 * single integer. Use it in place of read()
 	 */
 	u64 (*read_u64) (struct cgroup *cont, struct cftype *cft);
+	/*
+	 * read_map() is used for defining a map of key/value
+	 * pairs. It should call cb->fill(cb, key, value) for each
+	 * entry. The key/value pairs (and their ordering) should not
+	 * change between reboots.
+	 */
+	int (*read_map) (struct cgroup *cont, struct cftype *cft,
+			 struct cgroup_map_cb *cb);
+
 	ssize_t (*write) (struct cgroup *cont, struct cftype *cft,
 			  struct file *file,
 			  const char __user *buf, size_t nbytes, loff_t *ppos);
Index: cgroup-2.6.25-rc2-mm1/kernel/cgroup.c
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/kernel/cgroup.c
+++ cgroup-2.6.25-rc2-mm1/kernel/cgroup.c
@@ -1484,6 +1484,46 @@ static ssize_t cgroup_file_read(struct f
 	return -EINVAL;
 }
 
+/*
+ * seqfile ops/methods for returning structured data. Currently just
+ * supports string->u64 maps, but can be extended in future.
+ */
+
+struct cgroup_seqfile_state {
+	struct cftype *cft;
+	struct cgroup *cgroup;
+};
+
+static int cgroup_map_add(struct cgroup_map_cb *cb, const char *key, u64 value)
+{
+	struct seq_file *sf = cb->state;
+	return seq_printf(sf, "%s %llu\n", key, (unsigned long long)value);
+}
+
+static int cgroup_seqfile_show(struct seq_file *m, void *arg)
+{
+	struct cgroup_seqfile_state *state = m->private;
+	struct cftype *cft = state->cft;
+	struct cgroup_map_cb cb = {
+		.fill = cgroup_map_add,
+		.state = m,
+	};
+	return cft->read_map(state->cgroup, cft, &cb);
+}
+
+int cgroup_seqfile_release(struct inode *inode, struct file *file)
+{
+	struct seq_file *seq = file->private_data;
+	kfree(seq->private);
+	return single_release(inode, file);
+}
+
+static struct file_operations cgroup_seqfile_operations = {
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = cgroup_seqfile_release,
+};
+
 static int cgroup_file_open(struct inode *inode, struct file *file)
 {
 	int err;
@@ -1496,7 +1536,18 @@ static int cgroup_file_open(struct inode
 	cft = __d_cft(file->f_dentry);
 	if (!cft)
 		return -ENODEV;
-	if (cft->open)
+	if (cft->read_map) {
+		struct cgroup_seqfile_state *state =
+			kzalloc(sizeof(*state), GFP_USER);
+		if (!state)
+			return -ENOMEM;
+		state->cft = cft;
+		state->cgroup = __d_cgrp(file->f_dentry->d_parent);
+		file->f_op = &cgroup_seqfile_operations;
+		err = single_open(file, cgroup_seqfile_show, state);
+		if (err < 0)
+			kfree(state);
+	} else if (cft->open)
 		err = cft->open(inode, file);
 	else
 		err = 0;

--

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 07/10] CGroup API files: Use cgroup map for memcontrol stats file
  2008-02-23 22:47 [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files menage
                   ` (5 preceding siblings ...)
  2008-02-23 22:47 ` [PATCH 06/10] CGroup API files: Add cgroup map data type menage
@ 2008-02-23 22:47 ` menage
  2008-02-23 22:47 ` [PATCH 08/10] CGroup API files: Drop mem_cgroup_force_empty() menage
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: menage @ 2008-02-23 22:47 UTC (permalink / raw)
  To: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki, YAMAMOTO Takashi
  Cc: linux-kernel, containers

[-- Attachment #1: memcontrol_use_cgroup_map.patch --]
[-- Type: text/plain, Size: 2373 bytes --]

Remove the seq_file boilerplate used to construct the memcontrol stats
map, and instead use the new map representation for cgroup control
files

Signed-off-by: Paul Menage <menage@google.com>

---
 mm/memcontrol.c |   30 ++++++------------------------
 1 file changed, 6 insertions(+), 24 deletions(-)

Index: cgroup-2.6.25-rc2-mm1/mm/memcontrol.c
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/mm/memcontrol.c
+++ cgroup-2.6.25-rc2-mm1/mm/memcontrol.c
@@ -971,9 +971,9 @@ static const struct mem_cgroup_stat_desc
 	[MEM_CGROUP_STAT_RSS] = { "rss", PAGE_SIZE, },
 };
 
-static int mem_control_stat_show(struct seq_file *m, void *arg)
+static int mem_control_stat_show(struct cgroup *cont, struct cftype *cft,
+				 struct cgroup_map_cb *cb)
 {
-	struct cgroup *cont = m->private;
 	struct mem_cgroup *mem_cont = mem_cgroup_from_cont(cont);
 	struct mem_cgroup_stat *stat = &mem_cont->stat;
 	int i;
@@ -983,8 +983,7 @@ static int mem_control_stat_show(struct 
 
 		val = mem_cgroup_read_stat(stat, i);
 		val *= mem_cgroup_stat_desc[i].unit;
-		seq_printf(m, "%s %lld\n", mem_cgroup_stat_desc[i].msg,
-				(long long)val);
+		cb->fill(cb, mem_cgroup_stat_desc[i].msg, val);
 	}
 	/* showing # of active pages */
 	{
@@ -994,29 +993,12 @@ static int mem_control_stat_show(struct 
 						MEM_CGROUP_ZSTAT_INACTIVE);
 		active = mem_cgroup_get_all_zonestat(mem_cont,
 						MEM_CGROUP_ZSTAT_ACTIVE);
-		seq_printf(m, "active %ld\n", (active) * PAGE_SIZE);
-		seq_printf(m, "inactive %ld\n", (inactive) * PAGE_SIZE);
+		cb->fill(cb, "active", (active) * PAGE_SIZE);
+		cb->fill(cb, "inactive", (inactive) * PAGE_SIZE);
 	}
 	return 0;
 }
 
-static const struct file_operations mem_control_stat_file_operations = {
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-};
-
-static int mem_control_stat_open(struct inode *unused, struct file *file)
-{
-	/* XXX __d_cont */
-	struct cgroup *cont = file->f_dentry->d_parent->d_fsdata;
-
-	file->f_op = &mem_control_stat_file_operations;
-	return single_open(file, mem_control_stat_show, cont);
-}
-
-
-
 static struct cftype mem_cgroup_files[] = {
 	{
 		.name = "usage_in_bytes",
@@ -1041,7 +1023,7 @@ static struct cftype mem_cgroup_files[] 
 	},
 	{
 		.name = "stat",
-		.open = mem_control_stat_open,
+		.read_map = mem_control_stat_show,
 	},
 };
 

--

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 08/10] CGroup API files: Drop mem_cgroup_force_empty()
  2008-02-23 22:47 [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files menage
                   ` (6 preceding siblings ...)
  2008-02-23 22:47 ` [PATCH 07/10] CGroup API files: Use cgroup map for memcontrol stats file menage
@ 2008-02-23 22:47 ` menage
  2008-02-23 22:47 ` [PATCH 09/10] CGroup API files: Move "releasable" to cgroup_debug subsystem menage
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: menage @ 2008-02-23 22:47 UTC (permalink / raw)
  To: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki, YAMAMOTO Takashi
  Cc: linux-kernel, containers

[-- Attachment #1: drop_mem_cgroup_force_empty.patch --]
[-- Type: text/plain, Size: 1074 bytes --]

This function isn't needed - a NULL pointer in the cftype read
function will result in the same EINVAL response to userspace.

Signed-off-by: Paul Menage <menage@google.com>

---
 mm/memcontrol.c |   14 --------------
 1 file changed, 14 deletions(-)

Index: cgroup-2.6.25-rc2-mm1/mm/memcontrol.c
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/mm/memcontrol.c
+++ cgroup-2.6.25-rc2-mm1/mm/memcontrol.c
@@ -950,19 +950,6 @@ static ssize_t mem_force_empty_write(str
 	return ret;
 }
 
-/*
- * Note: This should be removed if cgroup supports write-only file.
- */
-
-static ssize_t mem_force_empty_read(struct cgroup *cont,
-				struct cftype *cft,
-				struct file *file, char __user *userbuf,
-				size_t nbytes, loff_t *ppos)
-{
-	return -EINVAL;
-}
-
-
 static const struct mem_cgroup_stat_desc {
 	const char *msg;
 	u64 unit;
@@ -1019,7 +1006,6 @@ static struct cftype mem_cgroup_files[] 
 	{
 		.name = "force_empty",
 		.write = mem_force_empty_write,
-		.read = mem_force_empty_read,
 	},
 	{
 		.name = "stat",

--

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 09/10] CGroup API files: Move "releasable" to cgroup_debug subsystem
  2008-02-23 22:47 [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files menage
                   ` (7 preceding siblings ...)
  2008-02-23 22:47 ` [PATCH 08/10] CGroup API files: Drop mem_cgroup_force_empty() menage
@ 2008-02-23 22:47 ` menage
  2008-02-23 22:47 ` [PATCH 10/10] CGroup API files: Make CGROUP_DEBUG default to off menage
  2008-02-26  3:23 ` [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files Li Zefan
  10 siblings, 0 replies; 17+ messages in thread
From: menage @ 2008-02-23 22:47 UTC (permalink / raw)
  To: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki, YAMAMOTO Takashi
  Cc: linux-kernel, containers

[-- Attachment #1: move_releasable.patch --]
[-- Type: text/plain, Size: 3764 bytes --]

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>

---
 include/linux/cgroup.h |   11 +++++++++++
 kernel/cgroup.c        |   23 -----------------------
 kernel/cgroup_debug.c  |   12 +++++++++++-
 3 files changed, 22 insertions(+), 24 deletions(-)

Index: cgroup-2.6.25-rc2-mm1/include/linux/cgroup.h
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/include/linux/cgroup.h
+++ cgroup-2.6.25-rc2-mm1/include/linux/cgroup.h
@@ -88,6 +88,17 @@ static inline void css_put(struct cgroup
 		__css_put(css);
 }
 
+/* bits in struct cgroup flags field */
+enum {
+	/* Control Group is dead */
+	CGRP_REMOVED,
+	/* Control Group has previously had a child cgroup or a task,
+	 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) */
+	CGRP_RELEASABLE,
+	/* Control Group requires release notifications to userspace */
+	CGRP_NOTIFY_ON_RELEASE,
+};
+
 struct cgroup {
 	unsigned long flags;		/* "unsigned long" so bitops work */
 
Index: cgroup-2.6.25-rc2-mm1/kernel/cgroup.c
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/kernel/cgroup.c
+++ cgroup-2.6.25-rc2-mm1/kernel/cgroup.c
@@ -119,17 +119,6 @@ static int root_count;
  */
 static int need_forkexit_callback;
 
-/* bits in struct cgroup flags field */
-enum {
-	/* Control Group is dead */
-	CGRP_REMOVED,
-	/* Control Group has previously had a child cgroup or a task,
-	 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) */
-	CGRP_RELEASABLE,
-	/* Control Group requires release notifications to userspace */
-	CGRP_NOTIFY_ON_RELEASE,
-};
-
 /* convenient tests for these bits */
 inline int cgroup_is_removed(const struct cgroup *cgrp)
 {
@@ -1299,7 +1288,6 @@ enum cgroup_filetype {
 	FILE_DIR,
 	FILE_TASKLIST,
 	FILE_NOTIFY_ON_RELEASE,
-	FILE_RELEASABLE,
 	FILE_RELEASE_AGENT,
 };
 
@@ -2169,11 +2157,6 @@ static u64 cgroup_read_notify_on_release
 	return notify_on_release(cgrp);
 }
 
-static u64 cgroup_read_releasable(struct cgroup *cgrp, struct cftype *cft)
-{
-	return test_bit(CGRP_RELEASABLE, &cgrp->flags);
-}
-
 /*
  * for the common functions, 'private' gives the type of file
  */
@@ -2193,12 +2176,6 @@ static struct cftype files[] = {
 		.write = cgroup_common_file_write,
 		.private = FILE_NOTIFY_ON_RELEASE,
 	},
-
-	{
-		.name = "releasable",
-		.read_u64 = cgroup_read_releasable,
-		.private = FILE_RELEASABLE,
-	}
 };
 
 static struct cftype cft_release_agent = {
Index: cgroup-2.6.25-rc2-mm1/kernel/cgroup_debug.c
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/kernel/cgroup_debug.c
+++ cgroup-2.6.25-rc2-mm1/kernel/cgroup_debug.c
@@ -1,5 +1,5 @@
 /*
- * kernel/ccontainer_debug.c - Example cgroup subsystem that
+ * kernel/cgroup_debug.c - Example cgroup subsystem that
  * exposes debug info
  *
  * Copyright (C) Google Inc, 2007
@@ -62,6 +62,11 @@ static u64 current_css_set_refcount_read
 	return count;
 }
 
+static u64 releasable_read(struct cgroup *cgrp, struct cftype *cft)
+{
+	return test_bit(CGRP_RELEASABLE, &cgrp->flags);
+}
+
 static struct cftype files[] =  {
 	{
 		.name = "cgroup_refcount",
@@ -81,6 +86,11 @@ static struct cftype files[] =  {
 		.name = "current_css_set_refcount",
 		.read_u64 = current_css_set_refcount_read,
 	},
+
+	{
+		.name = "releasable",
+		.read_u64 = releasable_read,
+	}
 };
 
 static int debug_populate(struct cgroup_subsys *ss, struct cgroup *cont)

--

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 10/10] CGroup API files: Make CGROUP_DEBUG default to off
  2008-02-23 22:47 [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files menage
                   ` (8 preceding siblings ...)
  2008-02-23 22:47 ` [PATCH 09/10] CGroup API files: Move "releasable" to cgroup_debug subsystem menage
@ 2008-02-23 22:47 ` menage
  2008-02-26  3:23 ` [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files Li Zefan
  10 siblings, 0 replies; 17+ messages in thread
From: menage @ 2008-02-23 22:47 UTC (permalink / raw)
  To: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki, YAMAMOTO Takashi
  Cc: linux-kernel, containers

[-- Attachment #1: default_off_cgroup_debug.patch --]
[-- Type: text/plain, Size: 643 bytes --]

The cgroup debug subsystem isn't generally useful for users. It should default to "n".

Signed-off-by: Paul Menage <menage@google.com>

---
 init/Kconfig |    1 +
 1 file changed, 1 insertion(+)

Index: cgroup-2.6.25-rc2-mm1/init/Kconfig
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/init/Kconfig
+++ cgroup-2.6.25-rc2-mm1/init/Kconfig
@@ -284,6 +284,7 @@ config CGROUPS
 config CGROUP_DEBUG
 	bool "Example debug cgroup subsystem"
 	depends on CGROUPS
+	default n
 	help
 	  This option enables a simple cgroup subsystem that
 	  exports useful debugging information about the cgroups

--

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files
  2008-02-23 22:47 [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files menage
                   ` (9 preceding siblings ...)
  2008-02-23 22:47 ` [PATCH 10/10] CGroup API files: Make CGROUP_DEBUG default to off menage
@ 2008-02-26  3:23 ` Li Zefan
  2008-02-26  6:19   ` Paul Menage
  10 siblings, 1 reply; 17+ messages in thread
From: Li Zefan @ 2008-02-26  3:23 UTC (permalink / raw)
  To: menage
  Cc: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki,
	YAMAMOTO Takashi, linux-kernel, containers

menage@google.com wrote:
> This patchset is a roll-up of the non-contraversial items of the
> various patches that I've sent out recently, fixed according to the
> feedback received.
> 
> In summary they are:
> 
> - general rename of read_uint/write_uint to read_u64/write_u64
> 
> - use these methods for cpusets and memory controller files
> 
> - add a read_map cgroup file method, and use it in the memory
>   controller
> 
> - move the "releasable" control file to the debug subsystem
> 
> - make the debug subsystem config option default to "n"
> 
> The only user-visible changes are the movement of the "releasable"
> file and the fact that some write_u64()-based control files are now
> more forgiving of additional whitespace at the end of their input.
> 
> Signed-off-by: Paul Menage <menage@google.com>
> 
> --
> --

Should those pathces be rebased againt 2.6.25-rc3 ?

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files
  2008-02-26  3:23 ` [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files Li Zefan
@ 2008-02-26  6:19   ` Paul Menage
  2008-02-26  7:48     ` Li Zefan
  0 siblings, 1 reply; 17+ messages in thread
From: Paul Menage @ 2008-02-26  6:19 UTC (permalink / raw)
  To: Li Zefan
  Cc: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki,
	YAMAMOTO Takashi, linux-kernel, containers

On Mon, Feb 25, 2008 at 7:23 PM, Li Zefan <lizf@cn.fujitsu.com> wrote:
>
>  Should those pathces be rebased againt 2.6.25-rc3 ?
>

No, because they're against 2.6.25-rc2-mm1, which is already has (I
think) any of the new bits in 2.6.25-rc3 that would be affected by
these patches.

Paul

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files
  2008-02-26  6:19   ` Paul Menage
@ 2008-02-26  7:48     ` Li Zefan
  2008-02-27  1:09       ` Paul Menage
  0 siblings, 1 reply; 17+ messages in thread
From: Li Zefan @ 2008-02-26  7:48 UTC (permalink / raw)
  To: Paul Menage
  Cc: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki,
	YAMAMOTO Takashi, linux-kernel, containers

Paul Menage wrote:
> On Mon, Feb 25, 2008 at 7:23 PM, Li Zefan <lizf@cn.fujitsu.com> wrote:
>>  Should those pathces be rebased againt 2.6.25-rc3 ?
>>
> 
> No, because they're against 2.6.25-rc2-mm1, which is already has (I
> think) any of the new bits in 2.6.25-rc3 that would be affected by
> these patches.
> 
> Paul

-rc2-mm1 came out on 2008-02-16, but the patches I posted several days ago
has been merged into -rc3, so your patches don't apply now. :(

Think about ./MAINTAINERS update and set up a git tree for development of
cgroup and cgroup subsystems as Andrew suggested. :)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 05/10] CGroup API files: Update cpusets to use cgroup structured file API
  2008-02-23 22:47 ` [PATCH 05/10] CGroup API files: Update cpusets to use cgroup structured file API menage
@ 2008-02-27  0:54   ` Li Zefan
  2008-02-27  1:09     ` Paul Menage
  0 siblings, 1 reply; 17+ messages in thread
From: Li Zefan @ 2008-02-27  0:54 UTC (permalink / raw)
  To: menage
  Cc: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki,
	YAMAMOTO Takashi, linux-kernel, containers

menage@google.com wrote:
> +	case FILE_MEMORY_MIGRATE:
> +		return is_memory_migrate(cs);
> +	case FILE_MEMORY_PRESSURE_ENABLED:
> +		return cpuset_memory_pressure_enabled;
> +	case FILE_MEMORY_PRESSURE:
> +		return fmeter_getrate(&cs->fmeter);
> +		break;

redundant 'break'

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files
  2008-02-26  7:48     ` Li Zefan
@ 2008-02-27  1:09       ` Paul Menage
  0 siblings, 0 replies; 17+ messages in thread
From: Paul Menage @ 2008-02-27  1:09 UTC (permalink / raw)
  To: Li Zefan
  Cc: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki,
	YAMAMOTO Takashi, linux-kernel, containers

On Mon, Feb 25, 2008 at 11:48 PM, Li Zefan <lizf@cn.fujitsu.com> wrote:
>
>  -rc2-mm1 came out on 2008-02-16, but the patches I posted several days ago
>  has been merged into -rc3, so your patches don't apply now. :(

OK, good point.

>
>  Think about ./MAINTAINERS update and set up a git tree for development of
>  cgroup and cgroup subsystems as Andrew suggested. :)
>

Sounds like a good plan - I'll get on to it ...

Paul

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 05/10] CGroup API files: Update cpusets to use cgroup structured file API
  2008-02-27  0:54   ` Li Zefan
@ 2008-02-27  1:09     ` Paul Menage
  0 siblings, 0 replies; 17+ messages in thread
From: Paul Menage @ 2008-02-27  1:09 UTC (permalink / raw)
  To: Li Zefan
  Cc: akpm, balbir, pj, Pavel Emelianov, KAMEZAWA Hiroyuki,
	YAMAMOTO Takashi, linux-kernel, containers

On Tue, Feb 26, 2008 at 4:54 PM, Li Zefan <lizf@cn.fujitsu.com> wrote:
> menage@google.com wrote:
>  > +     case FILE_MEMORY_MIGRATE:
>  > +             return is_memory_migrate(cs);
>  > +     case FILE_MEMORY_PRESSURE_ENABLED:
>  > +             return cpuset_memory_pressure_enabled;
>  > +     case FILE_MEMORY_PRESSURE:
>  > +             return fmeter_getrate(&cs->fmeter);
>  > +             break;
>
>  redundant 'break'
>

Thanks, I'll zap that.

Paul

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2008-02-27  1:10 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-23 22:47 [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files menage
2008-02-23 22:47 ` [PATCH 01/10] CGroup API files: Rename read/write_uint methods to read_write_u64 menage
2008-02-23 22:47 ` [PATCH 02/10] CGroup API files: Add res_counter_read_u64() menage
2008-02-23 22:47 ` [PATCH 03/10] CGroup API files: Use read_u64 in memory controller menage
2008-02-23 22:47 ` [PATCH 04/10] CGroup API files: Strip all trailing whitespace in cgroup_write_u64 menage
2008-02-23 22:47 ` [PATCH 05/10] CGroup API files: Update cpusets to use cgroup structured file API menage
2008-02-27  0:54   ` Li Zefan
2008-02-27  1:09     ` Paul Menage
2008-02-23 22:47 ` [PATCH 06/10] CGroup API files: Add cgroup map data type menage
2008-02-23 22:47 ` [PATCH 07/10] CGroup API files: Use cgroup map for memcontrol stats file menage
2008-02-23 22:47 ` [PATCH 08/10] CGroup API files: Drop mem_cgroup_force_empty() menage
2008-02-23 22:47 ` [PATCH 09/10] CGroup API files: Move "releasable" to cgroup_debug subsystem menage
2008-02-23 22:47 ` [PATCH 10/10] CGroup API files: Make CGROUP_DEBUG default to off menage
2008-02-26  3:23 ` [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files Li Zefan
2008-02-26  6:19   ` Paul Menage
2008-02-26  7:48     ` Li Zefan
2008-02-27  1:09       ` Paul Menage

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).