* [PATCH 0/2] ResCounter: Add res_counter_read_uint and use it in memory cgroup @ 2008-02-21 20:35 menage 2008-02-21 20:35 ` [PATCH 1/2] ResCounter: Add res_counter_read_uint() menage 2008-02-21 20:35 ` [PATCH 2/2] ResCounter: Use read_uint in memory controller menage 0 siblings, 2 replies; 12+ messages in thread From: menage @ 2008-02-21 20:35 UTC (permalink / raw) To: akpm, xemul, balbir; +Cc: linux-kernel, linux-mm These patches simplify the code required to report values from a res_counter object in a cgroups control file. The first patch adds res_counter_read_uint, which simply reports the current value for a res_counter member. The second replaces the existing mem_cgroup_read() with a simpler version that calls res_counter_read_uint(). Signed-off-by: Paul Menage <menage@google.com> -- -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/2] ResCounter: Add res_counter_read_uint() 2008-02-21 20:35 [PATCH 0/2] ResCounter: Add res_counter_read_uint and use it in memory cgroup menage @ 2008-02-21 20:35 ` menage 2008-02-21 20:35 ` [PATCH 2/2] ResCounter: Use read_uint in memory controller menage 1 sibling, 0 replies; 12+ messages in thread From: menage @ 2008-02-21 20:35 UTC (permalink / raw) To: akpm, xemul, balbir; +Cc: linux-kernel, linux-mm [-- Attachment #1: resource_counter_read_uint.patch --] [-- Type: text/plain, Size: 1896 bytes --] Adds a function for returning the value of a resource counter member, in a form suitable for use in a cgroup read_uint control file method. Signed-off-by: Paul Menage <menage@google.com> --- include/linux/res_counter.h | 1 + kernel/res_counter.c | 5 +++++ 2 files changed, 6 insertions(+) Index: rescounter-2.6.25-rc2-mm1/include/linux/res_counter.h =================================================================== --- rescounter-2.6.25-rc2-mm1.orig/include/linux/res_counter.h +++ rescounter-2.6.25-rc2-mm1/include/linux/res_counter.h @@ -54,6 +54,7 @@ struct res_counter { ssize_t res_counter_read(struct res_counter *counter, int member, const char __user *buf, size_t nbytes, loff_t *pos, int (*read_strategy)(unsigned long long val, char *s)); +u64 res_counter_read_uint(struct res_counter *counter, int member); ssize_t res_counter_write(struct res_counter *counter, int member, const char __user *buf, size_t nbytes, loff_t *pos, int (*write_strategy)(char *buf, unsigned long long *val)); Index: rescounter-2.6.25-rc2-mm1/kernel/res_counter.c =================================================================== --- rescounter-2.6.25-rc2-mm1.orig/kernel/res_counter.c +++ rescounter-2.6.25-rc2-mm1/kernel/res_counter.c @@ -92,6 +92,11 @@ ssize_t res_counter_read(struct res_coun pos, buf, s - buf); } +u64 res_counter_read_uint(struct res_counter *counter, int member) +{ + return *res_counter_member(counter, member); +} + ssize_t res_counter_write(struct res_counter *counter, int member, const char __user *userbuf, size_t nbytes, loff_t *pos, int (*write_strategy)(char *st_buf, unsigned long long *val)) -- -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/2] ResCounter: Use read_uint in memory controller 2008-02-21 20:35 [PATCH 0/2] ResCounter: Add res_counter_read_uint and use it in memory cgroup menage 2008-02-21 20:35 ` [PATCH 1/2] ResCounter: Add res_counter_read_uint() menage @ 2008-02-21 20:35 ` menage 2008-02-22 4:29 ` Balbir Singh 2008-02-22 7:51 ` Pavel Emelyanov 1 sibling, 2 replies; 12+ messages in thread From: menage @ 2008-02-21 20:35 UTC (permalink / raw) To: akpm, xemul, balbir; +Cc: linux-kernel, linux-mm [-- Attachment #1: memcontrol_use_res_counter_read_uint.patch --] [-- Type: text/plain, Size: 1804 bytes --] Update the memory controller to use read_uint for its limit/usage/failcnt control files, calling the new res_counter_read_uint() function. Signed-off-by: Paul Menage <menage@google.com> --- mm/memcontrol.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) Index: rescounter-2.6.25-rc2-mm1/mm/memcontrol.c =================================================================== --- rescounter-2.6.25-rc2-mm1.orig/mm/memcontrol.c +++ rescounter-2.6.25-rc2-mm1/mm/memcontrol.c @@ -922,13 +922,10 @@ int mem_cgroup_write_strategy(char *buf, return 0; } -static ssize_t mem_cgroup_read(struct cgroup *cont, - struct cftype *cft, struct file *file, - char __user *userbuf, size_t nbytes, loff_t *ppos) +static u64 mem_cgroup_read(struct cgroup *cont, struct cftype *cft) { - return res_counter_read(&mem_cgroup_from_cont(cont)->res, - cft->private, userbuf, nbytes, ppos, - NULL); + return res_counter_read_uint(&mem_cgroup_from_cont(cont)->res, + cft->private); } static ssize_t mem_cgroup_write(struct cgroup *cont, struct cftype *cft, @@ -1024,18 +1021,18 @@ static struct cftype mem_cgroup_files[] { .name = "usage_in_bytes", .private = RES_USAGE, - .read = mem_cgroup_read, + .read_uint = mem_cgroup_read, }, { .name = "limit_in_bytes", .private = RES_LIMIT, .write = mem_cgroup_write, - .read = mem_cgroup_read, + .read_uint = mem_cgroup_read, }, { .name = "failcnt", .private = RES_FAILCNT, - .read = mem_cgroup_read, + .read_uint = mem_cgroup_read, }, { .name = "force_empty", -- -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] ResCounter: Use read_uint in memory controller 2008-02-21 20:35 ` [PATCH 2/2] ResCounter: Use read_uint in memory controller menage @ 2008-02-22 4:29 ` Balbir Singh 2008-02-23 8:04 ` Andrew Morton 2008-02-23 14:33 ` Paul Menage 2008-02-22 7:51 ` Pavel Emelyanov 1 sibling, 2 replies; 12+ messages in thread From: Balbir Singh @ 2008-02-22 4:29 UTC (permalink / raw) To: menage; +Cc: akpm, xemul, balbir, linux-kernel, linux-mm menage@google.com wrote: > Update the memory controller to use read_uint for its > limit/usage/failcnt control files, calling the new > res_counter_read_uint() function. > > Signed-off-by: Paul Menage <menage@google.com> > Hi, Paul, Looks good, except for the name uint(), can we make it u64(). Integers are 32 bit on both ILP32 and LP64, but we really read/write 64 bit values. -- Warm Regards, Balbir Singh Linux Technology Center IBM, ISTL -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] ResCounter: Use read_uint in memory controller 2008-02-22 4:29 ` Balbir Singh @ 2008-02-23 8:04 ` Andrew Morton 2008-02-23 8:18 ` KOSAKI Motohiro 2008-02-23 9:16 ` Balbir Singh 2008-02-23 14:33 ` Paul Menage 1 sibling, 2 replies; 12+ messages in thread From: Andrew Morton @ 2008-02-23 8:04 UTC (permalink / raw) To: balbir; +Cc: menage, xemul, balbir, linux-kernel, linux-mm On Fri, 22 Feb 2008 09:59:41 +0530 Balbir Singh <balbir@linux.vnet.ibm.com> wrote: > menage@google.com wrote: > > Update the memory controller to use read_uint for its > > limit/usage/failcnt control files, calling the new > > res_counter_read_uint() function. > > > > Signed-off-by: Paul Menage <menage@google.com> > > > > Hi, Paul, > > Looks good, except for the name uint(), can we make it u64(). Integers are 32 > bit on both ILP32 and LP64, but we really read/write 64 bit values. > yup, I agree. Even though I don't know what ILP32 and LP64 are ;) -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] ResCounter: Use read_uint in memory controller 2008-02-23 8:04 ` Andrew Morton @ 2008-02-23 8:18 ` KOSAKI Motohiro 2008-02-23 9:16 ` Balbir Singh 1 sibling, 0 replies; 12+ messages in thread From: KOSAKI Motohiro @ 2008-02-23 8:18 UTC (permalink / raw) To: Andrew Morton Cc: kosaki.motohiro, balbir, menage, xemul, balbir, linux-kernel, linux-mm Hi Andrew, > yup, I agree. Even though I don't know what ILP32 and LP64 are ;) ILP32: integer and long and pointer size is 32bit LP64: long and pointer size is 64bit, but int size is 32bit linux 32bit kernel obey ILP32 model, 64bit kernel obey LP64. Thanks. - kosaki -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] ResCounter: Use read_uint in memory controller 2008-02-23 8:04 ` Andrew Morton 2008-02-23 8:18 ` KOSAKI Motohiro @ 2008-02-23 9:16 ` Balbir Singh 1 sibling, 0 replies; 12+ messages in thread From: Balbir Singh @ 2008-02-23 9:16 UTC (permalink / raw) To: Andrew Morton; +Cc: menage, xemul, balbir, linux-kernel, linux-mm Andrew Morton wrote: > On Fri, 22 Feb 2008 09:59:41 +0530 Balbir Singh <balbir@linux.vnet.ibm.com> wrote: > >> menage@google.com wrote: >>> Update the memory controller to use read_uint for its >>> limit/usage/failcnt control files, calling the new >>> res_counter_read_uint() function. >>> >>> Signed-off-by: Paul Menage <menage@google.com> >>> >> Hi, Paul, >> >> Looks good, except for the name uint(), can we make it u64(). Integers are 32 >> bit on both ILP32 and LP64, but we really read/write 64 bit values. >> > > yup, I agree. Even though I don't know what ILP32 and LP64 are ;) ILP32 and LP64 are programming models. They stand for Integer, Long, Pointer 32 bit for 32 bit systems and Long, Pointer 64 bit for 64 bit systems (which implies integers are 32 bit). -- Warm Regards, Balbir Singh Linux Technology Center IBM, ISTL -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] ResCounter: Use read_uint in memory controller 2008-02-22 4:29 ` Balbir Singh 2008-02-23 8:04 ` Andrew Morton @ 2008-02-23 14:33 ` Paul Menage 2008-02-23 18:59 ` Andrew Morton 1 sibling, 1 reply; 12+ messages in thread From: Paul Menage @ 2008-02-23 14:33 UTC (permalink / raw) To: balbir; +Cc: akpm, xemul, balbir, linux-kernel, linux-mm On Thu, Feb 21, 2008 at 8:29 PM, Balbir Singh <balbir@linux.vnet.ibm.com> wrote: > > Looks good, except for the name uint(), can we make it u64(). Integers are 32 > bit on both ILP32 and LP64, but we really read/write 64 bit values. Yes, that's true. But read_uint() is more consistent with all the other instances in cgroups and subsystems. So if we were to call it res_counter_read_u64() I'd also want to rename all the other *read_uint functions/fields to *read_u64 too. Can I do that in a separate patch? Paul -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] ResCounter: Use read_uint in memory controller 2008-02-23 14:33 ` Paul Menage @ 2008-02-23 18:59 ` Andrew Morton 2008-02-24 2:47 ` Balbir Singh 0 siblings, 1 reply; 12+ messages in thread From: Andrew Morton @ 2008-02-23 18:59 UTC (permalink / raw) To: Paul Menage; +Cc: balbir, xemul, balbir, linux-kernel, linux-mm On Sat, 23 Feb 2008 06:33:34 -0800 "Paul Menage" <menage@google.com> wrote: > On Thu, Feb 21, 2008 at 8:29 PM, Balbir Singh <balbir@linux.vnet.ibm.com> wrote: > > > > Looks good, except for the name uint(), can we make it u64(). Integers are 32 > > bit on both ILP32 and LP64, but we really read/write 64 bit values. > > Yes, that's true. But read_uint() is more consistent with all the > other instances in cgroups and subsystems. So if we were to call it > res_counter_read_u64() I'd also want to rename all the other > *read_uint functions/fields to *read_u64 too. Can I do that in a > separate patch? > Sounds sensible to me. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] ResCounter: Use read_uint in memory controller 2008-02-23 18:59 ` Andrew Morton @ 2008-02-24 2:47 ` Balbir Singh 2008-02-24 3:06 ` Paul Menage 0 siblings, 1 reply; 12+ messages in thread From: Balbir Singh @ 2008-02-24 2:47 UTC (permalink / raw) To: Andrew Morton; +Cc: Paul Menage, xemul, balbir, linux-kernel, linux-mm Andrew Morton wrote: > On Sat, 23 Feb 2008 06:33:34 -0800 "Paul Menage" <menage@google.com> wrote: > >> On Thu, Feb 21, 2008 at 8:29 PM, Balbir Singh <balbir@linux.vnet.ibm.com> wrote: >>> Looks good, except for the name uint(), can we make it u64(). Integers are 32 >>> bit on both ILP32 and LP64, but we really read/write 64 bit values. >> Yes, that's true. But read_uint() is more consistent with all the >> other instances in cgroups and subsystems. So if we were to call it >> res_counter_read_u64() I'd also want to rename all the other >> *read_uint functions/fields to *read_u64 too. Can I do that in a >> separate patch? >> > > Sounds sensible to me. > Sure, fair enough. -- Warm Regards, Balbir Singh Linux Technology Center IBM, ISTL -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] ResCounter: Use read_uint in memory controller 2008-02-24 2:47 ` Balbir Singh @ 2008-02-24 3:06 ` Paul Menage 0 siblings, 0 replies; 12+ messages in thread From: Paul Menage @ 2008-02-24 3:06 UTC (permalink / raw) To: balbir; +Cc: Andrew Morton, xemul, balbir, linux-kernel, linux-mm On Sat, Feb 23, 2008 at 6:47 PM, Balbir Singh <balbir@linux.vnet.ibm.com> wrote: > >> res_counter_read_u64() I'd also want to rename all the other > >> *read_uint functions/fields to *read_u64 too. Can I do that in a > >> separate patch? > >> > > > > Sounds sensible to me. > > > > Sure, fair enough. > Actually, since multiple people were asking for this change I did the search/replace and sent it out already (as a precursor of the other patches in the series that I sent today). Paul -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] ResCounter: Use read_uint in memory controller 2008-02-21 20:35 ` [PATCH 2/2] ResCounter: Use read_uint in memory controller menage 2008-02-22 4:29 ` Balbir Singh @ 2008-02-22 7:51 ` Pavel Emelyanov 1 sibling, 0 replies; 12+ messages in thread From: Pavel Emelyanov @ 2008-02-22 7:51 UTC (permalink / raw) To: menage, akpm; +Cc: balbir, linux-kernel, linux-mm menage@google.com wrote: > Update the memory controller to use read_uint for its > limit/usage/failcnt control files, calling the new > res_counter_read_uint() function. > > Signed-off-by: Paul Menage <menage@google.com> Acked-by: Pavel Emelyanov <xemul@openvz.org> -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2008-02-24 3:06 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-02-21 20:35 [PATCH 0/2] ResCounter: Add res_counter_read_uint and use it in memory cgroup menage 2008-02-21 20:35 ` [PATCH 1/2] ResCounter: Add res_counter_read_uint() menage 2008-02-21 20:35 ` [PATCH 2/2] ResCounter: Use read_uint in memory controller menage 2008-02-22 4:29 ` Balbir Singh 2008-02-23 8:04 ` Andrew Morton 2008-02-23 8:18 ` KOSAKI Motohiro 2008-02-23 9:16 ` Balbir Singh 2008-02-23 14:33 ` Paul Menage 2008-02-23 18:59 ` Andrew Morton 2008-02-24 2:47 ` Balbir Singh 2008-02-24 3:06 ` Paul Menage 2008-02-22 7:51 ` Pavel Emelyanov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).