mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Balbir Singh <balbir@linux.vnet.ibm.com>
To: Li Zefan <lizf@cn.fujitsu.com>, akpm@linux-foundation.org
Cc: Paul Jackson <pj@sgi.com>, Paul Menage <menage@google.com>,
	xemul@openvz.org, kamezawa.hiroyu@jp.fujitsu.com,
	vatsa@linux.vnet.ibm.com, containers@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH 7/7] CGroup API: Update cpusets to use cgroup structured file API
Date: Mon, 18 Feb 2008 16:43:33 +0530	[thread overview]
Message-ID: <20080218111333.GA6333@balbir.in.ibm.com> (raw)
In-Reply-To: <47B96805.7070002@linux.vnet.ibm.com>

* Balbir Singh <balbir@linux.vnet.ibm.com> [2008-02-18 16:42:05]:

> Li Zefan wrote:
> > Paul Jackson wrote:
> >> Ok ... this would (I suspect, just from code reading, no bytes were
> >> harmed in actual testing of this) have a minor change to how white
> >> space is handled writing integer flags to cpuset files, and a minor
> >> inconstency.
> >>
> >>  1) Existing cpuset code lets you set a flag (e.g. cpu_exclusive) by doing:
> >> 	echo '1 rumplestiltskin' > cpu_exclusive   # same as: echo 1 > cpu_exclusive
> >>     With this patch, that probably fails, EINVAL.
> >>
> >>  2) With this patch, one can write "1" or "1\n" to cpuset integer files, but one
> >>     cannot successfully write "1\r\n" or "1 " or "1 \n".  However, for the cpuset
> >>     control files that take strings, not single integers, one -can- have any mix
> >>     of trailing white space.
> >>
> >> So far as I know, I have no requirement to write rumplestiltskin to cpuset files ;).
> >> So I'm content to let the minor change in (1) pass without further comment.
> >>
> >> I'd like to recommend consideration of the following patch, to address the
> >> minor inconsistency of (2), and to save a few bytes of kernel text space.
> >>
> > 
> > For memory controller, we have to do this:
> > 	echo -n 4m > memory.limit_in_bytes
> > '-n' is necessary. This is another inconsistency..
> 
Hi. Li,
 
I have a similar patch that fixes the inconsistency.
It's attached below. Andrew, could we please consider this patch for -mm


The memory controller has a requirement that while writing values, we need
to use echo -n. This patch fixes the problem and makes the UI more consistent.

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
---

 Documentation/controllers/memory.txt |    8 ++++----
 kernel/res_counter.c                 |    1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff -puN mm/memcontrol.c~memory-controller-fix-crlf-echo-issue mm/memcontrol.c
diff -puN kernel/res_counter.c~memory-controller-fix-crlf-echo-issue kernel/res_counter.c
--- linux-2.6.25-rc2/kernel/res_counter.c~memory-controller-fix-crlf-echo-issue	2008-02-18 16:15:02.000000000 +0530
+++ linux-2.6.25-rc2-balbir/kernel/res_counter.c	2008-02-18 16:16:16.000000000 +0530
@@ -113,6 +113,7 @@ ssize_t res_counter_write(struct res_cou
 
 	ret = -EINVAL;
 
+	strstrip(buf);
 	if (write_strategy) {
 		if (write_strategy(buf, &tmp)) {
 			goto out_free;
diff -puN Documentation/controllers/memory.txt~memory-controller-fix-crlf-echo-issue Documentation/controllers/memory.txt
--- linux-2.6.25-rc2/Documentation/controllers/memory.txt~memory-controller-fix-crlf-echo-issue	2008-02-18 16:18:26.000000000 +0530
+++ linux-2.6.25-rc2-balbir/Documentation/controllers/memory.txt	2008-02-18 16:18:44.000000000 +0530
@@ -164,7 +164,7 @@ c. Enable CONFIG_CGROUP_MEM_CONT
 
 Since now we're in the 0 cgroup,
 We can alter the memory limit:
-# echo -n 4M > /cgroups/0/memory.limit_in_bytes
+# echo 4M > /cgroups/0/memory.limit_in_bytes
 
 NOTE: We can use a suffix (k, K, m, M, g or G) to indicate values in kilo,
 mega or gigabytes.
@@ -185,7 +185,7 @@ number of factors, such as rounding up t
 availability of memory on the system.  The user is required to re-read
 this file after a write to guarantee the value committed by the kernel.
 
-# echo -n 1 > memory.limit_in_bytes
+# echo 1 > memory.limit_in_bytes
 # cat memory.limit_in_bytes
 4096 Bytes
 
@@ -197,7 +197,7 @@ caches, RSS and Active pages/Inactive pa
 
 The memory.force_empty gives an interface to drop *all* charges by force.
 
-# echo -n 1 > memory.force_empty
+# echo 1 > memory.force_empty
 
 will drop all charges in cgroup. Currently, this is maintained for test.
 
@@ -238,7 +238,7 @@ rmdir() if there are no tasks.
 The type of memory accounted by the cgroup can be limited to just
 mapped pages by writing "1" to memory.control_type field
 
-echo -n 1 > memory.control_type
+echo > memory.control_type
 
 5. TODO
 
_

-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

  parent reply	other threads:[~2008-02-18 11:17 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-15 20:44 [RFC][PATCH 0/7] CGroup API: More structured API for CGroups control files Paul Menage
2008-02-15 20:44 ` [RFC][PATCH 1/7] CGroup API: Add cgroup.api control file Paul Menage
2008-02-16 10:07   ` Balbir Singh
2008-02-16 17:44     ` Paul Menage
2008-02-18  9:45       ` Li Zefan
2008-02-18 10:32         ` Balbir Singh
2008-02-19 21:57         ` Paul Jackson
2008-02-20  2:51           ` Paul Menage
2008-02-20  5:17             ` Paul Jackson
2008-02-20  5:23               ` Paul Menage
2008-02-20  2:51         ` Paul Menage
2008-02-15 20:44 ` [RFC][PATCH 2/7] CGroup API: Add cgroup map data type Paul Menage
2008-02-15 20:44 ` [RFC][PATCH 3/7] CGroup API: Use cgroup map for memcontrol stats file Paul Menage
2008-02-15 20:44 ` [RFC][PATCH 4/7] CGroup API: Add res_counter_read_uint() Paul Menage
2008-02-15 20:44 ` [RFC][PATCH 5/7] CGroup API: Use read_uint in memory controller Paul Menage
2008-02-15 20:44 ` [RFC][PATCH 6/7] CGroup API: Use descriptions for memory controller API files Paul Menage
2008-02-15 20:44 ` [RFC][PATCH 7/7] CGroup API: Update cpusets to use cgroup structured file API Paul Menage
2008-02-17  3:29   ` Paul Jackson
2008-02-17 17:18     ` Paul Menage
2008-02-17 17:28       ` Paul Jackson
2008-02-17 17:48         ` Paul Menage
2008-02-18  9:55     ` Li Zefan
     [not found]       ` <47B96805.7070002@linux.vnet.ibm.com>
2008-02-18 11:13         ` Balbir Singh [this message]
2008-02-18 11:52           ` Andreas Schwab
     [not found]             ` <47B971C6.4080807@linux.vnet.ibm.com>
2008-02-18 11:56               ` Balbir Singh
2008-02-16  4:21 ` [RFC][PATCH 0/7] CGroup API: More structured API for CGroups control files KAMEZAWA Hiroyuki
2008-02-16  9:31   ` Li Zefan
2008-02-16 17:40     ` Paul Menage

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080218111333.GA6333@balbir.in.ibm.com \
    --to=balbir@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=containers@lists.linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=menage@google.com \
    --cc=pj@sgi.com \
    --cc=vatsa@linux.vnet.ibm.com \
    --cc=xemul@openvz.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®