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

2007-09-05 Thread Balbir Singh
On Sun, Sep 02, 2007 at 09:53:22PM -0700, Paul Menage wrote: > On 9/2/07, Balbir Singh <[EMAIL PROTECTED]> wrote: > > - s += sprintf(s, "%lu\n", *val); > > + if (read_strategy) > > + s += read_strategy(*val, s); > > + else > > + s += sprintf(s,

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

2007-09-05 Thread Balbir Singh
> > 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. > How does this look? Changelog for version 4 1. Make all resource counters members unsigned long long 2. Use documentation

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

2007-09-05 Thread Balbir Singh
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. How does this look? Changelog for version 4 1. Make all resource counters members unsigned long long 2. Use documentation

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

2007-09-05 Thread Balbir Singh
On Sun, Sep 02, 2007 at 09:53:22PM -0700, Paul Menage wrote: On 9/2/07, Balbir Singh [EMAIL PROTECTED] wrote: - s += sprintf(s, %lu\n, *val); + if (read_strategy) + s += read_strategy(*val, s); + else + s += sprintf(s, %lu\n, *val); This

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

2007-09-04 Thread Dave Hansen
On Sun, 2007-09-02 at 16:20 +0530, Balbir Singh wrote: > > +Setting a limit to a number that is not a multiple of page size causes > +rounding up of the value. The user must check back to see (by reading > +memory.limit_in_bytes), to check for differences between desired values and > +committed

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

2007-09-04 Thread Balbir Singh
Paul Menage wrote: > On 9/3/07, Balbir Singh <[EMAIL PROTECTED]> wrote: >> Paul Menage wrote: >>> On 9/2/07, Balbir Singh <[EMAIL PROTECTED]> wrote: - s += sprintf(s, "%lu\n", *val); + if (read_strategy) + s += read_strategy(*val, s); + else

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

2007-09-04 Thread Paul Menage
On 9/3/07, Balbir Singh <[EMAIL PROTECTED]> wrote: > Paul Menage wrote: > > On 9/2/07, Balbir Singh <[EMAIL PROTECTED]> wrote: > >> - s += sprintf(s, "%lu\n", *val); > >> + if (read_strategy) > >> + s += read_strategy(*val, s); > >> + else > >> + s +=

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

2007-09-04 Thread Paul Menage
On 9/3/07, Balbir Singh [EMAIL PROTECTED] wrote: Paul Menage wrote: On 9/2/07, Balbir Singh [EMAIL PROTECTED] wrote: - s += sprintf(s, %lu\n, *val); + if (read_strategy) + s += read_strategy(*val, s); + else + s += sprintf(s, %lu\n, *val);

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

2007-09-04 Thread Balbir Singh
Paul Menage wrote: On 9/3/07, Balbir Singh [EMAIL PROTECTED] wrote: Paul Menage wrote: On 9/2/07, Balbir Singh [EMAIL PROTECTED] wrote: - s += sprintf(s, %lu\n, *val); + if (read_strategy) + s += read_strategy(*val, s); + else + s += sprintf(s,

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

2007-09-04 Thread Dave Hansen
On Sun, 2007-09-02 at 16:20 +0530, Balbir Singh wrote: +Setting a limit to a number that is not a multiple of page size causes +rounding up of the value. The user must check back to see (by reading +memory.limit_in_bytes), to check for differences between desired values and +committed

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

2007-09-03 Thread Balbir Singh
Paul Menage wrote: > On 9/2/07, Balbir Singh <[EMAIL PROTECTED]> wrote: >> - s += sprintf(s, "%lu\n", *val); >> + if (read_strategy) >> + s += read_strategy(*val, s); >> + else >> + s += sprintf(s, "%lu\n", *val); > > This would be better as %llu >

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

2007-09-03 Thread Balbir Singh
Paul Menage wrote: > On 9/2/07, Balbir Singh <[EMAIL PROTECTED]> wrote: >> - s += sprintf(s, "%lu\n", *val); >> + if (read_strategy) >> + s += read_strategy(*val, s); >> + else >> + s += sprintf(s, "%lu\n", *val); > > This would be better as %llu >

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

2007-09-03 Thread Balbir Singh
Paul Menage wrote: On 9/2/07, Balbir Singh [EMAIL PROTECTED] wrote: - s += sprintf(s, %lu\n, *val); + if (read_strategy) + s += read_strategy(*val, s); + else + s += sprintf(s, %lu\n, *val); This would be better as %llu + tmp

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

2007-09-03 Thread Balbir Singh
Paul Menage wrote: On 9/2/07, Balbir Singh [EMAIL PROTECTED] wrote: - s += sprintf(s, %lu\n, *val); + if (read_strategy) + s += read_strategy(*val, s); + else + s += sprintf(s, %lu\n, *val); This would be better as %llu Hi, Paul, This does

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

2007-09-02 Thread Paul Menage
On 9/2/07, Balbir Singh <[EMAIL PROTECTED]> wrote: > - s += sprintf(s, "%lu\n", *val); > + if (read_strategy) > + s += read_strategy(*val, s); > + else > + s += sprintf(s, "%lu\n", *val); This would be better as %llu > + tmp =

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

2007-09-02 Thread Balbir Singh
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

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

2007-09-02 Thread Paul Menage
On 9/2/07, Balbir Singh [EMAIL PROTECTED] wrote: - s += sprintf(s, %lu\n, *val); + if (read_strategy) + s += read_strategy(*val, s); + else + s += sprintf(s, %lu\n, *val); This would be better as %llu + tmp = simple_strtoul(buf,

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

2007-08-31 Thread Balbir Singh
On 9/1/07, Andrew Morton <[EMAIL PROTECTED]> wrote: > On Fri, 31 Aug 2007 00:22:46 +0530 > Balbir Singh <[EMAIL PROTECTED]> wrote: > > > +/* > > + * Strategy routines for formating read/write data > > + */ > > +int mem_container_read_strategy(unsigned long long val, char *buf) > > +{ > > +

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

2007-08-31 Thread Andrew Morton
On Fri, 31 Aug 2007 00:22:46 +0530 Balbir Singh <[EMAIL PROTECTED]> wrote: > +/* > + * Strategy routines for formating read/write data > + */ > +int mem_container_read_strategy(unsigned long long val, char *buf) > +{ > + return sprintf(buf, "%llu Bytes\n", val); > +} It's a bit cheesy to be

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

2007-08-31 Thread Andrew Morton
On Fri, 31 Aug 2007 00:22:46 +0530 Balbir Singh [EMAIL PROTECTED] wrote: +/* + * Strategy routines for formating read/write data + */ +int mem_container_read_strategy(unsigned long long val, char *buf) +{ + return sprintf(buf, %llu Bytes\n, val); +} It's a bit cheesy to be printing

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

2007-08-31 Thread Balbir Singh
On 9/1/07, Andrew Morton [EMAIL PROTECTED] wrote: On Fri, 31 Aug 2007 00:22:46 +0530 Balbir Singh [EMAIL PROTECTED] wrote: +/* + * Strategy routines for formating read/write data + */ +int mem_container_read_strategy(unsigned long long val, char *buf) +{ + return sprintf(buf,

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

2007-08-30 Thread Balbir Singh
Balbir Singh wrote: > Change the interface to use kilobytes 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. > Typo, the description should be Changelog for

[-mm PATCH] Memory controller improve user interface (v2)

2007-08-30 Thread Balbir Singh
Change the interface to use kilobytes 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

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

2007-08-30 Thread Balbir Singh
KAMEZAWA Hiroyuki wrote: > On Thu, 30 Aug 2007 04:07:11 +0530 > Balbir Singh <[EMAIL PROTECTED]> wrote: >> 1. Several people recommended it >> 2. Herbert mentioned that they've moved to that interface and it >>was working fine for them. >> > > I have no strong opinion. But how about Mega

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

2007-08-30 Thread Balbir Singh
KAMEZAWA Hiroyuki wrote: On Thu, 30 Aug 2007 04:07:11 +0530 Balbir Singh [EMAIL PROTECTED] wrote: 1. Several people recommended it 2. Herbert mentioned that they've moved to that interface and it was working fine for them. I have no strong opinion. But how about Mega bytes ? (too big

[-mm PATCH] Memory controller improve user interface (v2)

2007-08-30 Thread Balbir Singh
Change the interface to use kilobytes 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

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

2007-08-30 Thread Balbir Singh
Balbir Singh wrote: Change the interface to use kilobytes 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. Typo, the description should be Changelog for

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

2007-08-29 Thread KAMEZAWA Hiroyuki
On Thu, 30 Aug 2007 04:07:11 +0530 Balbir Singh <[EMAIL PROTECTED]> wrote: > 1. Several people recommended it > 2. Herbert mentioned that they've moved to that interface and it >was working fine for them. > I have no strong opinion. But how about Mega bytes ? (too big ?) There will be no

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

2007-08-29 Thread Balbir Singh
Dave Hansen wrote: > On Thu, 2007-08-30 at 03:57 +0530, Balbir Singh wrote: >> True, mmap() is a good example of such an interface for developers, I >> am not sure about system admins though. >> >> To quote Andrew >> >> Reporting tools could run getpagesize() and do the arithmetic, but we >>

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

2007-08-29 Thread Balbir Singh
Dave Hansen wrote: > On Wed, 2007-08-29 at 15:20 -0700, Paul Menage wrote: >> I'd argue that having the user's specified limit be truncated to the >> page size is less confusing than giving an EINVAL if it's not page >> aligned. > > Do we truncate mmap() values to the nearest page so to not

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

2007-08-29 Thread Dave Hansen
On Thu, 2007-08-30 at 03:57 +0530, Balbir Singh wrote: > True, mmap() is a good example of such an interface for developers, I > am not sure about system admins though. > > To quote Andrew > > Reporting tools could run getpagesize() and do the arithmetic, but we > generally try to avoid exposing

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

2007-08-29 Thread Balbir Singh
Dave Hansen wrote: > On Thu, 2007-08-30 at 03:34 +0530, Balbir Singh wrote: >> I've thought about this before. The problem is that a user could >> set his limit to 1 bytes, but would then see the usage and >> limit round to the closest page boundary. This can be confusing >> to a user. > >

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

2007-08-29 Thread Dave Hansen
On Wed, 2007-08-29 at 15:20 -0700, Paul Menage wrote: > > I'd argue that having the user's specified limit be truncated to the > page size is less confusing than giving an EINVAL if it's not page > aligned. Do we truncate mmap() values to the nearest page so to not confuse the user? ;) Imagine

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

2007-08-29 Thread Paul Menage
On 8/29/07, Dave Hansen <[EMAIL PROTECTED]> wrote: > On Thu, 2007-08-30 at 03:34 +0530, Balbir Singh wrote: > > I've thought about this before. The problem is that a user could > > set his limit to 1 bytes, but would then see the usage and > > limit round to the closest page boundary. This can

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

2007-08-29 Thread Dave Hansen
On Thu, 2007-08-30 at 03:34 +0530, Balbir Singh wrote: > I've thought about this before. The problem is that a user could > set his limit to 1 bytes, but would then see the usage and > limit round to the closest page boundary. This can be confusing > to a user. True, but we're lying if we

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

2007-08-29 Thread Balbir Singh
Dave Hansen wrote: > On Wed, 2007-08-29 at 16:40 +0530, Balbir Singh wrote: >> >> @@ -352,7 +353,7 @@ int mem_container_charge(struct page *pa >> kfree(pc); >> pc = race_pc; >> atomic_inc(>ref_cnt); >> - res_counter_uncharge(>res, 1);

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

2007-08-29 Thread Dave Hansen
On Wed, 2007-08-29 at 16:40 +0530, Balbir Singh wrote: > > > @@ -352,7 +353,7 @@ int mem_container_charge(struct page *pa > kfree(pc); > pc = race_pc; > atomic_inc(>ref_cnt); > - res_counter_uncharge(>res, 1); > +

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

2007-08-29 Thread Paul Menage
On 8/29/07, Balbir Singh <[EMAIL PROTECTED]> wrote: > > > > This seems a bit inconsistent - if you write a value to a limit file, > > then the value that you read back is reduced by a factor of 1024? > > Having the "(kB)" suffix isn't really a big help to automated > > middleware. > > > > Why is

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

2007-08-29 Thread Balbir Singh
Paul Menage wrote: > On 8/29/07, Balbir Singh <[EMAIL PROTECTED]> wrote: >> Change the interface to use kilobytes 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

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

2007-08-29 Thread Paul Menage
On 8/29/07, Balbir Singh <[EMAIL PROTECTED]> wrote: > > Change the interface to use kilobytes 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

[-mm PATCH] Memory controller improve user interface

2007-08-29 Thread Balbir Singh
Change the interface to use kilobytes 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

[-mm PATCH] Memory controller improve user interface

2007-08-29 Thread Balbir Singh
Change the interface to use kilobytes 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

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

2007-08-29 Thread Paul Menage
On 8/29/07, Balbir Singh [EMAIL PROTECTED] wrote: Change the interface to use kilobytes 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

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

2007-08-29 Thread Balbir Singh
Paul Menage wrote: On 8/29/07, Balbir Singh [EMAIL PROTECTED] wrote: Change the interface to use kilobytes 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.

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

2007-08-29 Thread Paul Menage
On 8/29/07, Balbir Singh [EMAIL PROTECTED] wrote: This seems a bit inconsistent - if you write a value to a limit file, then the value that you read back is reduced by a factor of 1024? Having the (kB) suffix isn't really a big help to automated middleware. Why is that? Is it because

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

2007-08-29 Thread Dave Hansen
On Wed, 2007-08-29 at 16:40 +0530, Balbir Singh wrote: @@ -352,7 +353,7 @@ int mem_container_charge(struct page *pa kfree(pc); pc = race_pc; atomic_inc(pc-ref_cnt); - res_counter_uncharge(mem-res, 1); +

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

2007-08-29 Thread Balbir Singh
Dave Hansen wrote: On Wed, 2007-08-29 at 16:40 +0530, Balbir Singh wrote: @@ -352,7 +353,7 @@ int mem_container_charge(struct page *pa kfree(pc); pc = race_pc; atomic_inc(pc-ref_cnt); - res_counter_uncharge(mem-res, 1); +

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

2007-08-29 Thread Dave Hansen
On Thu, 2007-08-30 at 03:34 +0530, Balbir Singh wrote: I've thought about this before. The problem is that a user could set his limit to 1 bytes, but would then see the usage and limit round to the closest page boundary. This can be confusing to a user. True, but we're lying if we allow

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

2007-08-29 Thread Paul Menage
On 8/29/07, Dave Hansen [EMAIL PROTECTED] wrote: On Thu, 2007-08-30 at 03:34 +0530, Balbir Singh wrote: I've thought about this before. The problem is that a user could set his limit to 1 bytes, but would then see the usage and limit round to the closest page boundary. This can be

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

2007-08-29 Thread Dave Hansen
On Wed, 2007-08-29 at 15:20 -0700, Paul Menage wrote: I'd argue that having the user's specified limit be truncated to the page size is less confusing than giving an EINVAL if it's not page aligned. Do we truncate mmap() values to the nearest page so to not confuse the user? ;) Imagine a

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

2007-08-29 Thread Balbir Singh
Dave Hansen wrote: On Thu, 2007-08-30 at 03:34 +0530, Balbir Singh wrote: I've thought about this before. The problem is that a user could set his limit to 1 bytes, but would then see the usage and limit round to the closest page boundary. This can be confusing to a user. True, but

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

2007-08-29 Thread Dave Hansen
On Thu, 2007-08-30 at 03:57 +0530, Balbir Singh wrote: True, mmap() is a good example of such an interface for developers, I am not sure about system admins though. To quote Andrew quote Reporting tools could run getpagesize() and do the arithmetic, but we generally try to avoid exposing

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

2007-08-29 Thread Balbir Singh
Dave Hansen wrote: On Wed, 2007-08-29 at 15:20 -0700, Paul Menage wrote: I'd argue that having the user's specified limit be truncated to the page size is less confusing than giving an EINVAL if it's not page aligned. Do we truncate mmap() values to the nearest page so to not confuse the

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

2007-08-29 Thread Balbir Singh
Dave Hansen wrote: On Thu, 2007-08-30 at 03:57 +0530, Balbir Singh wrote: True, mmap() is a good example of such an interface for developers, I am not sure about system admins though. To quote Andrew quote Reporting tools could run getpagesize() and do the arithmetic, but we generally try

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

2007-08-29 Thread KAMEZAWA Hiroyuki
On Thu, 30 Aug 2007 04:07:11 +0530 Balbir Singh [EMAIL PROTECTED] wrote: 1. Several people recommended it 2. Herbert mentioned that they've moved to that interface and it was working fine for them. I have no strong opinion. But how about Mega bytes ? (too big ?) There will be no rounding