From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: Re: [PATCH 1/7] res_counter: add a function res_counter_move_parent(). Date: Mon, 16 Apr 2012 15:19:24 -0700 Message-ID: <20120416221924.GB12421@google.com> References: <4F86B9BE.8000105@jp.fujitsu.com> <4F86BA66.2010503@jp.fujitsu.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=efISsRD16SpTgjTiyZU11yVAh4uUeSVZP80rwbFbSUU=; b=t7zpzyDvN9kaaumU647kHtsz3Q/Do76nSntpw/scIw2sQ28U8Sw21eQ62bCjdoRu1c SR/N6beANrgwQ8LKsmwHh4g60U3QswD3bB7qq8Y9hBY2d0hpVD0gGd3jdDxhE6Q0gs4o hWg2zSFbBigjX7LB7w6tK/4l9GrJ//zTs9cBj1aGgE/b7CV9GxgrTOLgLltUlZJF326u +tz+wGaqkb7FQLT5VZj/VtpAYQGY8adAYOAwTvsjt8zXrOXLNd4RduEZpwBFanc1NbVx e4s47OgIa31vRJngCmI77Zo16r0rLo1JxJO9RQ1wFAwTDb86EZhzbzBFosiGet3rsNsi 32YQ== Content-Disposition: inline In-Reply-To: <4F86BA66.2010503-+CUm20s59erQFUHtdCDX3A@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: KAMEZAWA Hiroyuki Cc: "linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org" , "cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Michal Hocko , Johannes Weiner , Glauber Costa , Hugh Dickins , Andrew Morton On Thu, Apr 12, 2012 at 08:20:06PM +0900, KAMEZAWA Hiroyuki wrote: > > This function is used for moving accounting information to its > parent in the hierarchy of res_counter. > > Signed-off-by: KAMEZAWA Hiroyuki > --- > include/linux/res_counter.h | 3 +++ > kernel/res_counter.c | 13 +++++++++++++ > 2 files changed, 16 insertions(+), 0 deletions(-) > > diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h > index da81af0..8919d3c 100644 > --- a/include/linux/res_counter.h > +++ b/include/linux/res_counter.h > @@ -135,6 +135,9 @@ int __must_check res_counter_charge_nofail(struct res_counter *counter, > void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val); > void res_counter_uncharge(struct res_counter *counter, unsigned long val); > > +/* move resource to parent counter...i.e. just forget accounting in a child */ Can we drop this comment and > +void res_counter_move_parent(struct res_counter *counter, unsigned long val); > > +/* > + * In hierarchical accounting, child's usage is accounted into ancestors. > + * To move local usage to its parent, just forget current level usage. > + */ make this one proper docbook function comment? > +void res_counter_move_parent(struct res_counter *counter, unsigned long val) > +{ > + unsigned long flags; > + > + BUG_ON(!counter->parent); And let's please do "if (WARN_ON(!counter->parent)) return;" instead. Thanks. -- tejun From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx187.postini.com [74.125.245.187]) by kanga.kvack.org (Postfix) with SMTP id 8F7F56B0044 for ; Mon, 16 Apr 2012 18:19:36 -0400 (EDT) Received: by pbcup15 with SMTP id up15so8627464pbc.14 for ; Mon, 16 Apr 2012 15:19:35 -0700 (PDT) Date: Mon, 16 Apr 2012 15:19:24 -0700 From: Tejun Heo Subject: Re: [PATCH 1/7] res_counter: add a function res_counter_move_parent(). Message-ID: <20120416221924.GB12421@google.com> References: <4F86B9BE.8000105@jp.fujitsu.com> <4F86BA66.2010503@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F86BA66.2010503@jp.fujitsu.com> Sender: owner-linux-mm@kvack.org List-ID: To: KAMEZAWA Hiroyuki Cc: "linux-mm@kvack.org" , "cgroups@vger.kernel.org" , Michal Hocko , Johannes Weiner , Glauber Costa , Hugh Dickins , Andrew Morton On Thu, Apr 12, 2012 at 08:20:06PM +0900, KAMEZAWA Hiroyuki wrote: > > This function is used for moving accounting information to its > parent in the hierarchy of res_counter. > > Signed-off-by: KAMEZAWA Hiroyuki > --- > include/linux/res_counter.h | 3 +++ > kernel/res_counter.c | 13 +++++++++++++ > 2 files changed, 16 insertions(+), 0 deletions(-) > > diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h > index da81af0..8919d3c 100644 > --- a/include/linux/res_counter.h > +++ b/include/linux/res_counter.h > @@ -135,6 +135,9 @@ int __must_check res_counter_charge_nofail(struct res_counter *counter, > void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val); > void res_counter_uncharge(struct res_counter *counter, unsigned long val); > > +/* move resource to parent counter...i.e. just forget accounting in a child */ Can we drop this comment and > +void res_counter_move_parent(struct res_counter *counter, unsigned long val); > > +/* > + * In hierarchical accounting, child's usage is accounted into ancestors. > + * To move local usage to its parent, just forget current level usage. > + */ make this one proper docbook function comment? > +void res_counter_move_parent(struct res_counter *counter, unsigned long val) > +{ > + unsigned long flags; > + > + BUG_ON(!counter->parent); And let's please do "if (WARN_ON(!counter->parent)) return;" instead. Thanks. -- tejun -- 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/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org