aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-04-29 04:00:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:06:10 -0400
commitc84872e168d10926acd2dee975d19172eef79252 (patch)
treec28f4f87ad38b524fe2a4c1e0e590bea3aacd92a /mm
parentcf475ad28ac35cc9ba612d67158f29b73b38b05d (diff)
memcgroup: add the max_usage member on the res_counter
This field is the maximal value of the usage one since the counter creation (or since the latest reset). To reset this to the usage value simply write anything to the appropriate cgroup file. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memcontrol.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 49d80814798b..350a14da6525 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -855,6 +855,17 @@ static ssize_t mem_cgroup_write(struct cgroup *cont, struct cftype *cft,
855 mem_cgroup_write_strategy); 855 mem_cgroup_write_strategy);
856} 856}
857 857
858static ssize_t mem_cgroup_max_reset(struct cgroup *cont, struct cftype *cft,
859 struct file *file, const char __user *userbuf,
860 size_t nbytes, loff_t *ppos)
861{
862 struct mem_cgroup *mem;
863
864 mem = mem_cgroup_from_cont(cont);
865 res_counter_reset_max(&mem->res);
866 return nbytes;
867}
868
858static ssize_t mem_force_empty_write(struct cgroup *cont, 869static ssize_t mem_force_empty_write(struct cgroup *cont,
859 struct cftype *cft, struct file *file, 870 struct cftype *cft, struct file *file,
860 const char __user *userbuf, 871 const char __user *userbuf,
@@ -910,6 +921,12 @@ static struct cftype mem_cgroup_files[] = {
910 .read_u64 = mem_cgroup_read, 921 .read_u64 = mem_cgroup_read,
911 }, 922 },
912 { 923 {
924 .name = "max_usage_in_bytes",
925 .private = RES_MAX_USAGE,
926 .write = mem_cgroup_max_reset,
927 .read_u64 = mem_cgroup_read,
928 },
929 {
913 .name = "limit_in_bytes", 930 .name = "limit_in_bytes",
914 .private = RES_LIMIT, 931 .private = RES_LIMIT,
915 .write = mem_cgroup_write, 932 .write = mem_cgroup_write,