From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail190.messagelabs.com (mail190.messagelabs.com [216.82.249.51]) by kanga.kvack.org (Postfix) with ESMTP id A42556B004A for ; Wed, 6 Oct 2010 09:30:46 -0400 (EDT) Received: from d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by e3.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id o96DE46L022881 for ; Wed, 6 Oct 2010 09:14:04 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o96DUUjY119054 for ; Wed, 6 Oct 2010 09:30:30 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o96DUTfW008500 for ; Wed, 6 Oct 2010 10:30:30 -0300 Date: Wed, 6 Oct 2010 19:00:24 +0530 From: Balbir Singh Subject: Re: [PATCH 08/10] memcg: add cgroupfs interface to memcg dirty limits Message-ID: <20101006133024.GE4195@balbir.in.ibm.com> Reply-To: balbir@linux.vnet.ibm.com References: <1286175485-30643-1-git-send-email-gthelen@google.com> <1286175485-30643-9-git-send-email-gthelen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1286175485-30643-9-git-send-email-gthelen@google.com> Sender: owner-linux-mm@kvack.org To: Greg Thelen Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, containers@lists.osdl.org, Andrea Righi , KAMEZAWA Hiroyuki , Daisuke Nishimura List-ID: * Greg Thelen [2010-10-03 23:58:03]: > Add cgroupfs interface to memcg dirty page limits: > Direct write-out is controlled with: > - memory.dirty_ratio > - memory.dirty_bytes > > Background write-out is controlled with: > - memory.dirty_background_ratio > - memory.dirty_background_bytes > > Signed-off-by: Andrea Righi > Signed-off-by: Greg Thelen > --- The added interface is not uniform with the rest of our write operations. Does the patch below help? I did a quick compile and run test. Make writes to memcg dirty tunables more uniform From: Balbir Singh We today support 'M', 'm', 'k', 'K', 'g' and 'G' suffixes for general memcg writes. This patch provides the same functionality for dirty tunables. --- mm/memcontrol.c | 47 +++++++++++++++++++++++++++++++++++++---------- 1 files changed, 37 insertions(+), 10 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 2d45a0a..3c360e6 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4323,6 +4323,41 @@ static u64 mem_cgroup_dirty_read(struct cgroup *cgrp, struct cftype *cft) } static int +mem_cgroup_dirty_write_string(struct cgroup *cont, struct cftype *cft, + const char *buffer) +{ + struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); + int type = cft->private; + int ret = -EINVAL; + unsigned long long val; + + if (cgrp->parent == NULL) + return ret; + + switch (type) { + case MEM_CGROUP_DIRTY_BYTES: + /* This function does all necessary parse...reuse it */ + ret = res_counter_memparse_write_strategy(buffer, &val); + if (ret) + break; + memcg->dirty_param.dirty_bytes = val; + memcg->dirty_param.dirty_ratio = 0; + break; + case MEM_CGROUP_DIRTY_BACKGROUND_BYTES: + ret = res_counter_memparse_write_strategy(buffer, &val); + if (ret) + break; + memcg->dirty_param.dirty_background_bytes = val; + memcg->dirty_param.dirty_background_ratio = 0; + break; + default: + BUG(); + break; + } + return ret; +} + +static int mem_cgroup_dirty_write(struct cgroup *cgrp, struct cftype *cft, u64 val) { struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); @@ -4338,18 +4373,10 @@ mem_cgroup_dirty_write(struct cgroup *cgrp, struct cftype *cft, u64 val) memcg->dirty_param.dirty_ratio = val; memcg->dirty_param.dirty_bytes = 0; break; - case MEM_CGROUP_DIRTY_BYTES: - memcg->dirty_param.dirty_bytes = val; - memcg->dirty_param.dirty_ratio = 0; - break; case MEM_CGROUP_DIRTY_BACKGROUND_RATIO: memcg->dirty_param.dirty_background_ratio = val; memcg->dirty_param.dirty_background_bytes = 0; break; - case MEM_CGROUP_DIRTY_BACKGROUND_BYTES: - memcg->dirty_param.dirty_background_bytes = val; - memcg->dirty_param.dirty_background_ratio = 0; - break; default: BUG(); break; @@ -4429,7 +4456,7 @@ static struct cftype mem_cgroup_files[] = { { .name = "dirty_bytes", .read_u64 = mem_cgroup_dirty_read, - .write_u64 = mem_cgroup_dirty_write, + .write_string = mem_cgroup_dirty_write_string, .private = MEM_CGROUP_DIRTY_BYTES, }, { @@ -4441,7 +4468,7 @@ static struct cftype mem_cgroup_files[] = { { .name = "dirty_background_bytes", .read_u64 = mem_cgroup_dirty_read, - .write_u64 = mem_cgroup_dirty_write, + .write_u64 = mem_cgroup_dirty_write_string, .private = MEM_CGROUP_DIRTY_BACKGROUND_BYTES, }, }; -- Three Cheers, Balbir -- 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: email@kvack.org