Commit fb78922ce9c71b24c4af1ffc9c3d60c57ac471fb

Authored by Balbir Singh
Committed by Linus Torvalds
1 parent a10568733c

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: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 4 additions and 3 deletions Side-by-side Diff

Documentation/controllers/memory.txt
... ... @@ -164,7 +164,7 @@
164 164  
165 165 Since now we're in the 0 cgroup,
166 166 We can alter the memory limit:
167   -# echo -n 4M > /cgroups/0/memory.limit_in_bytes
  167 +# echo 4M > /cgroups/0/memory.limit_in_bytes
168 168  
169 169 NOTE: We can use a suffix (k, K, m, M, g or G) to indicate values in kilo,
170 170 mega or gigabytes.
... ... @@ -185,7 +185,7 @@
185 185 availability of memory on the system. The user is required to re-read
186 186 this file after a write to guarantee the value committed by the kernel.
187 187  
188   -# echo -n 1 > memory.limit_in_bytes
  188 +# echo 1 > memory.limit_in_bytes
189 189 # cat memory.limit_in_bytes
190 190 4096
191 191  
... ... @@ -197,7 +197,7 @@
197 197  
198 198 The memory.force_empty gives an interface to drop *all* charges by force.
199 199  
200   -# echo -n 1 > memory.force_empty
  200 +# echo 1 > memory.force_empty
201 201  
202 202 will drop all charges in cgroup. Currently, this is maintained for test.
203 203  
kernel/res_counter.c
... ... @@ -113,6 +113,7 @@
113 113  
114 114 ret = -EINVAL;
115 115  
  116 + strstrip(buf);
116 117 if (write_strategy) {
117 118 if (write_strategy(buf, &tmp)) {
118 119 goto out_free;