Commit fb78922c authored by Balbir Singh's avatar Balbir Singh Committed by Linus Torvalds

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.
Signed-off-by: default avatarBalbir Singh <balbir@linux.vnet.ibm.com>
Cc: Paul Menage <menage@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a1056873
...@@ -164,7 +164,7 @@ c. Enable CONFIG_CGROUP_MEM_CONT ...@@ -164,7 +164,7 @@ c. Enable CONFIG_CGROUP_MEM_CONT
Since now we're in the 0 cgroup, Since now we're in the 0 cgroup,
We can alter the memory limit: 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, NOTE: We can use a suffix (k, K, m, M, g or G) to indicate values in kilo,
mega or gigabytes. mega or gigabytes.
...@@ -185,7 +185,7 @@ number of factors, such as rounding up to page boundaries or the total ...@@ -185,7 +185,7 @@ number of factors, such as rounding up to page boundaries or the total
availability of memory on the system. The user is required to re-read 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. 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 # cat memory.limit_in_bytes
4096 4096
...@@ -197,7 +197,7 @@ caches, RSS and Active pages/Inactive pages are shown. ...@@ -197,7 +197,7 @@ caches, RSS and Active pages/Inactive pages are shown.
The memory.force_empty gives an interface to drop *all* charges by force. 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. will drop all charges in cgroup. Currently, this is maintained for test.
......
...@@ -113,6 +113,7 @@ ssize_t res_counter_write(struct res_counter *counter, int member, ...@@ -113,6 +113,7 @@ ssize_t res_counter_write(struct res_counter *counter, int member,
ret = -EINVAL; ret = -EINVAL;
strstrip(buf);
if (write_strategy) { if (write_strategy) {
if (write_strategy(buf, &tmp)) { if (write_strategy(buf, &tmp)) {
goto out_free; goto out_free;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment