login
Header Space

 
 

Re: [-mm PATCH] Memory controller improve user interface (v3)

Previous thread: Re: [ANNOUNCE] GIT 1.5.3 by Alex Riesen on Sunday, September 2, 2007 - 6:28 am. (1 message)

Next thread: hang with CONFIG_MCYRIXIII by Mark Hindley on Sunday, September 2, 2007 - 7:04 am. (4 messages)
To: Andrew Morton <akpm@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Linux Containers <containers@...>, Paul Menage <menage@...>, Linux MM Mailing List <linux-mm@...>, David Rientjes <rientjes@...>, Balbir Singh <balbir@...>, Dave Hansen <haveblue@...>
Date: Sunday, September 2, 2007 - 6:50 am

Changelog for version 3
1. Change memory.limit and memory.usage to memory.limit_in_bytes and
   memory.usage_in_bytes respectively
2. Remove "Bytes" from the output of the limit and usage counters
3. Remove spurious printk

Changelog for version 2

1. Back end tracking is done in bytes, round up values of the limit if the
   specified value is not a multiple of page size. Display memory.usage
   and memory.limit in bytes (Dave Hansen, Paul Menage)

Change the interface to use bytes instead of pages. Page sizes can vary
across platforms and configurations. A new strategy routine has been added
to the resource counters infrastructure to format the data as desired.

Suggested by David Rientjes, Andrew Morton and Herbert Poetzl

Tested on a UML setup with the config for memory control enabled.
---


Signed-off-by: Balbir Singh &lt;balbir@linux.vnet.ibm.com&gt;
---

 Documentation/controllers/memory.txt |   28 ++++++++++++++---
 include/linux/res_counter.h          |   10 +++---
 kernel/res_counter.c                 |   30 +++++++++++++-----
 mm/memcontrol.c                      |   56 +++++++++++++++++++++++++++--------
 4 files changed, 94 insertions(+), 30 deletions(-)

diff -puN Documentation/controllers/memory.txt~mem-control-make-ui-more-usable Documentation/controllers/memory.txt
--- linux-2.6.23-rc4/Documentation/controllers/memory.txt~mem-control-make-ui-more-usable	2007-09-02 15:42:03.000000000 +0530
+++ linux-2.6.23-rc4-balbir/Documentation/controllers/memory.txt	2007-09-02 15:47:12.000000000 +0530
@@ -165,11 +165,29 @@ c. Enable CONFIG_CONTAINER_MEM_CONT
 
 Since now we're in the 0 container,
 We can alter the memory limit:
-# echo -n 6000 &gt; /containers/0/memory.limit
+# echo -n 4M &gt; /containers/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.
+
+# cat /containers/0/memory.limit_in_bytes
+4194304 Bytes
+
+NOTE: The interface has now changed to display the usage in bytes
+instead ...
To: Balbir Singh <balbir@...>
Cc: Andrew Morton <akpm@...>, Linux Kernel Mailing List <linux-kernel@...>, Linux Containers <containers@...>, Paul Menage <menage@...>, Linux MM Mailing List <linux-mm@...>, David Rientjes <rientjes@...>
Date: Tuesday, September 4, 2007 - 3:03 pm

I wonder if we can say this in a bit more generic fashion.

        A successful write to this file does not guarantee a successful
        set of this limit to the value written into the file.  This can
        be due to a 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 this file after a write to
        guarantee the value committed by the kernel.

This keeps a user from saying "I page aligned the value I stuck in
there, no I don't have to check it."

-- Dave

-
To: Balbir Singh <balbir@...>
Cc: Andrew Morton <akpm@...>, Linux Kernel Mailing List <linux-kernel@...>, Linux Containers <containers@...>, Linux MM Mailing List <linux-mm@...>, David Rientjes <rientjes@...>, Dave Hansen <haveblue@...>
Date: Monday, September 3, 2007 - 12:53 am

and this as simple_strtoull()

Paul
-
To: Paul Menage <menage@...>
Cc: Andrew Morton <akpm@...>, Linux Kernel Mailing List <linux-kernel@...>, Linux Containers <containers@...>, Linux MM Mailing List <linux-mm@...>, David Rientjes <rientjes@...>, Dave Hansen <haveblue@...>
Date: Monday, September 3, 2007 - 3:55 pm

Hi,

Here's the new patch for the UI changes. I hope I've got it right
(Jetlag can do funny things to the mind and eyes :-) )

Changelog for version 4

1. Fix parsing of unsigned long long arguments.

Changelog for version 3
1. Change memory.limit and memory.usage to memory.limit_in_bytes and
   memory.usage_in_bytes respectively
2. Remove "Bytes" from the output of the limit and usage counters
3. Remove spurious printk

Changelog for version 2

1. Back end tracking is done in bytes, round up values of the limit if the
   specified value is not a multiple of page size. Display memory.usage
   and memory.limit in bytes (Dave Hansen, Paul Menage)

Change the interface to use bytes instead of pages. Page sizes can vary
across platforms and configurations. A new strategy routine has been added
to the resource counters infrastructure to format the data as desired.

Suggested by David Rientjes, Andrew Morton and Herbert Poetzl

Tested on a UML setup with the config for memory control enabled.
---


Signed-off-by: Balbir Singh &lt;balbir@linux.vnet.ibm.com&gt;
---

 Documentation/controllers/memory.txt |   28 ++++++++++++++---
 include/linux/res_counter.h          |   10 +++---
 kernel/res_counter.c                 |   30 +++++++++++++-----
 mm/memcontrol.c                      |   56 +++++++++++++++++++++++++++--------
 4 files changed, 94 insertions(+), 30 deletions(-)

diff -puN Documentation/controllers/memory.txt~mem-control-make-ui-more-usable Documentation/controllers/memory.txt
--- linux-2.6.23-rc4/Documentation/controllers/memory.txt~mem-control-make-ui-more-usable	2007-09-02 11:12:03.000000000 +0100
+++ linux-2.6.23-rc4-balbir/Documentation/controllers/memory.txt	2007-09-02 11:17:12.000000000 +0100
@@ -165,11 +165,29 @@ c. Enable CONFIG_CONTAINER_MEM_CONT
 
 Since now we're in the 0 container,
 We can alter the memory limit:
-# echo -n 6000 &gt; /containers/0/memory.limit
+# echo -n 4M &gt; /containers/0/memory.limit_in_bytes
+
+NOTE: We can use a suffix (k, ...
To: Paul Menage <menage@...>
Cc: Andrew Morton <akpm@...>, Linux Kernel Mailing List <linux-kernel@...>, Linux Containers <containers@...>, Linux MM Mailing List <linux-mm@...>, David Rientjes <rientjes@...>, Dave Hansen <haveblue@...>
Date: Monday, September 3, 2007 - 3:49 pm

Hi, Paul,

This does not need fixing, since the other counters like failcnt are


Will do, thanks!



-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL
-
To: <balbir@...>
Cc: Andrew Morton <akpm@...>, Linux Kernel Mailing List <linux-kernel@...>, Linux Containers <containers@...>, Linux MM Mailing List <linux-mm@...>, David Rientjes <rientjes@...>, Dave Hansen <haveblue@...>
Date: Tuesday, September 4, 2007 - 3:19 am

But val is an unsigned long long*. So printing *val with %lu will
break (at least a warning, and maybe corruption if you had other
parameters) on 32-bit archs.

Paul
-
To: Paul Menage <menage@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Linux MM Mailing List <linux-mm@...>, David Rientjes <rientjes@...>, Linux Containers <containers@...>, Andrew Morton <akpm@...>
Date: Wednesday, September 5, 2007 - 12:05 pm

How does this look?


Changelog for version 4

1. Make all resource counters members unsigned long long
2. Use documentation comments from Dave Hansen

Changelog for version 3
1. Change memory.limit and memory.usage to memory.limit_in_bytes and
   memory.usage_in_bytes respectively
2. Remove "Bytes" from the output of the limit and usage counters
3. Remove spurious printk

Changelog for version 2

1. Back end tracking is done in bytes, round up values of the limit if the
   specified value is not a multiple of page size. Display memory.usage
   and memory.limit in bytes (Dave Hansen, Paul Menage)

Change the interface to use bytes instead of pages. Page sizes can vary
across platforms and configurations. A new strategy routine has been added
to the resource counters infrastructure to format the data as desired.

Suggested by David Rientjes, Andrew Morton and Herbert Poetzl

Tested on a UML setup with the config for memory control enabled.

Signed-off-by: Balbir Singh &lt;balbir@linux.vnet.ibm.com&gt;
---

 Documentation/controllers/memory.txt |   29 ++++++++++++++++++++++++-----
 include/linux/res_counter.h          |   12 +++++++-----
 kernel/res_counter.c                 |   34 +++++++++++++++++++++++-----------
 mm/memcontrol.c                      |   35 +++++++++++++++++++++++++----------
 4 files changed, 79 insertions(+), 31 deletions(-)

diff -puN Documentation/controllers/memory.txt~mem-control-make-ui-more-usable Documentation/controllers/memory.txt
--- linux-2.6.23-rc4/Documentation/controllers/memory.txt~mem-control-make-ui-more-usable	2007-09-02 11:12:03.000000000 +0100
+++ linux-2.6.23-rc4-balbir/Documentation/controllers/memory.txt	2007-09-05 16:44:41.000000000 +0100
@@ -165,11 +165,30 @@ c. Enable CONFIG_CONTAINER_MEM_CONT
 
 Since now we're in the 0 container,
 We can alter the memory limit:
-# echo -n 6000 &gt; /containers/0/memory.limit
+# echo -n 4M &gt; /containers/0/memory.limit_in_bytes
+
+NOTE: We can use a suffix (k, K, m, M, g or G) to ind...
To: Paul Menage <menage@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Linux MM Mailing List <linux-mm@...>, David Rientjes <rientjes@...>, Linux Containers <containers@...>, Andrew Morton <akpm@...>
Date: Tuesday, September 4, 2007 - 3:28 am

Yeah... Hmm.. just wonder if all the counters should be unsigned long
long? failcnt is the only remaining unsigned long counter now.

-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL
-
To: Paul Menage <menage@...>
Cc: Andrew Morton <akpm@...>, Linux Kernel Mailing List <linux-kernel@...>, Linux Containers <containers@...>, Linux MM Mailing List <linux-mm@...>, David Rientjes <rientjes@...>, Dave Hansen <haveblue@...>
Date: Monday, September 3, 2007 - 3:45 pm

Thanks for catching it, I'll fix that.

-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL
-
Previous thread: Re: [ANNOUNCE] GIT 1.5.3 by Alex Riesen on Sunday, September 2, 2007 - 6:28 am. (1 message)

Next thread: hang with CONFIG_MCYRIXIII by Mark Hindley on Sunday, September 2, 2007 - 7:04 am. (4 messages)
speck-geostationary