Skip to contentSkip to conversation

Memory Resource Controller use strstrip while parsing arguments

PATCH In review Balbir Singh 2 participants 3 messages Feb 25, 2008 – Feb 26, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Memory Resource Controller use strstrip while parsing arguments

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.

---

 Documentation/controllers/memory.txt |    6 +++---
 kernel/res_counter.c                 |    1 +
 2 files changed, 4 insertions(+), 3 deletions(-)
Documentation/controllers/memory.txt renamed from Documentation/controllers/memory.txt~memory-controller-fix-crlf-echo-issue +3 -3
diff -puN Documentation/controllers/memory.txt~memory-controller-fix-crlf-echo-issue Documentation/controllers/memory.txt
@@ -168,7 +168,7 @@ c. Enable CONFIG_CGROUP_MEM_RES_CTLR
 
 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.
@@ -189,7 +189,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
 
@@ -201,7 +201,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.
 
kernel/res_counter.c renamed from kernel/res_counter.c~memory-controller-fix-crlf-echo-issue +1 -0
diff -puN kernel/res_counter.c~memory-controller-fix-crlf-echo-issue kernel/res_counter.c
@@ -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;

_

Signature · 10 lines
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
maintainer
#1 lore raw
Quoted 2 lines · On Mon, 25 Feb 2008 23:57:46 +0530 Balbir Singh <[email protected]>…

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.

that's a decent improvement ;)

btw, could I ask that you, Paul and others who work on this and cgroups have a think about a ./MAINTAINERS update?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 9 lines · Andrew Morton
Quoted 2 lines · On Mon, 25 Feb 2008 23:57:46 +0530 Balbir Singh <[email protected]>…

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.

that's a decent improvement ;)

btw, could I ask that you, Paul and others who work on this and cgroups have a think about a ./MAINTAINERS update?

Aah.. yes.. we should do that.

Signature · 10 lines
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>