From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753972Ab0HXGKV (ORCPT ); Tue, 24 Aug 2010 02:10:21 -0400 Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:53796 "EHLO fgwmail6.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753408Ab0HXGKS (ORCPT ); Tue, 24 Aug 2010 02:10:18 -0400 X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 Date: Tue, 24 Aug 2010 15:05:16 +0900 From: KAMEZAWA Hiroyuki To: Daisuke Nishimura Cc: linux-mm@kvack.org, "balbir@linux.vnet.ibm.com" , gthelen@google.com, m-ikeda@ds.jp.nec.com, "akpm@linux-foundation.org" , "linux-kernel@vger.kernel.org" , kamezawa.hiroyuki@gmail.com Subject: Re: [PATCH] memcg: use ID in page_cgroup Message-Id: <20100824150516.000f21b5.kamezawa.hiroyu@jp.fujitsu.com> In-Reply-To: <20100824130402.9ee7447b.nishimura@mxp.nes.nec.co.jp> References: <20100820185552.426ff12e.kamezawa.hiroyu@jp.fujitsu.com> <20100820190132.43684862.kamezawa.hiroyu@jp.fujitsu.com> <20100823143237.b7822ffc.nishimura@mxp.nes.nec.co.jp> <20100824085243.8dd3c8de.kamezawa.hiroyu@jp.fujitsu.com> <20100824101425.2dc25773.nishimura@mxp.nes.nec.co.jp> <20100824105405.abf226e6.kamezawa.hiroyu@jp.fujitsu.com> <20100824130402.9ee7447b.nishimura@mxp.nes.nec.co.jp> Organization: FUJITSU Co. LTD. X-Mailer: Sylpheed 3.0.3 (GTK+ 2.10.14; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 24 Aug 2010 13:04:02 +0900 Daisuke Nishimura wrote: > On Tue, 24 Aug 2010 10:54:05 +0900 > KAMEZAWA Hiroyuki wrote: > > > On Tue, 24 Aug 2010 10:14:25 +0900 > > Daisuke Nishimura wrote: > > > > > > > > @@ -723,6 +729,11 @@ static inline bool mem_cgroup_is_root(st > > > > > > return (mem == root_mem_cgroup); > > > > > > } > > > > > > > > > > > > +static inline bool mem_cgroup_is_rootid(unsigned short id) > > > > > > +{ > > > > > > + return (id == 1); > > > > > > +} > > > > > > + > > > > > It might be better to add > > > > > > > > > > BUG_ON(newid->id != 1) > > > > > > > > > > in cgroup.c::cgroup_init_idr(). > > > > > > > > > > > > > Why ?? > > > > > > > Just to make sure that the root css has id==1. mem_cgroup_is_rootid() make > > > use of the fact. > > > I'm sorry if I miss something. > > > > > > > Hmm. The function allocating ID does > > > > 4530 static struct css_id *get_new_cssid(struct cgroup_subsys *ss, int depth) > > 4531 { > > == > > 4546 spin_lock(&ss->id_lock); > > 4547 /* Don't use 0. allocates an ID of 1-65535 */ > > 4548 error = idr_get_new_above(&ss->idr, newid, 1, &myid); > > 4549 spin_unlock(&ss->id_lock); > > == > > > > and allocates ID above "1", always. > > > > Adding BUG_ON(newid->id != 1) will mean that we doubt the bitmap function and > > consider possibility that new->id == 0. > > > > But, we're 100% sure that it never happens. > > > > I don't think adding a comment is a right thing to do. > > > Okey, I don't have strong requirement to add BUG_ON() anyway. > > These patches looks good to me except for some minor points I've commented. > Thank you for review. I'll repost after applying your feedback. -Kame 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 SMTP id 3BFF960080F for ; Tue, 24 Aug 2010 02:10:24 -0400 (EDT) Received: from m3.gw.fujitsu.co.jp ([10.0.50.73]) by fgwmail6.fujitsu.co.jp (Fujitsu Gateway) with ESMTP id o7O6AKuI029144 for (envelope-from kamezawa.hiroyu@jp.fujitsu.com); Tue, 24 Aug 2010 15:10:20 +0900 Received: from smail (m3 [127.0.0.1]) by outgoing.m3.gw.fujitsu.co.jp (Postfix) with ESMTP id E954C45DE50 for ; Tue, 24 Aug 2010 15:10:19 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (s3.gw.fujitsu.co.jp [10.0.50.93]) by m3.gw.fujitsu.co.jp (Postfix) with ESMTP id C72A245DE4E for ; Tue, 24 Aug 2010 15:10:19 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id A7D031DB8037 for ; Tue, 24 Aug 2010 15:10:19 +0900 (JST) Received: from ml13.s.css.fujitsu.com (ml13.s.css.fujitsu.com [10.249.87.103]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id 36944E08001 for ; Tue, 24 Aug 2010 15:10:16 +0900 (JST) Date: Tue, 24 Aug 2010 15:05:16 +0900 From: KAMEZAWA Hiroyuki Subject: Re: [PATCH] memcg: use ID in page_cgroup Message-Id: <20100824150516.000f21b5.kamezawa.hiroyu@jp.fujitsu.com> In-Reply-To: <20100824130402.9ee7447b.nishimura@mxp.nes.nec.co.jp> References: <20100820185552.426ff12e.kamezawa.hiroyu@jp.fujitsu.com> <20100820190132.43684862.kamezawa.hiroyu@jp.fujitsu.com> <20100823143237.b7822ffc.nishimura@mxp.nes.nec.co.jp> <20100824085243.8dd3c8de.kamezawa.hiroyu@jp.fujitsu.com> <20100824101425.2dc25773.nishimura@mxp.nes.nec.co.jp> <20100824105405.abf226e6.kamezawa.hiroyu@jp.fujitsu.com> <20100824130402.9ee7447b.nishimura@mxp.nes.nec.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org To: Daisuke Nishimura Cc: linux-mm@kvack.org, "balbir@linux.vnet.ibm.com" , gthelen@google.com, m-ikeda@ds.jp.nec.com, "akpm@linux-foundation.org" , "linux-kernel@vger.kernel.org" , kamezawa.hiroyuki@gmail.com List-ID: On Tue, 24 Aug 2010 13:04:02 +0900 Daisuke Nishimura wrote: > On Tue, 24 Aug 2010 10:54:05 +0900 > KAMEZAWA Hiroyuki wrote: > > > On Tue, 24 Aug 2010 10:14:25 +0900 > > Daisuke Nishimura wrote: > > > > > > > > @@ -723,6 +729,11 @@ static inline bool mem_cgroup_is_root(st > > > > > > return (mem == root_mem_cgroup); > > > > > > } > > > > > > > > > > > > +static inline bool mem_cgroup_is_rootid(unsigned short id) > > > > > > +{ > > > > > > + return (id == 1); > > > > > > +} > > > > > > + > > > > > It might be better to add > > > > > > > > > > BUG_ON(newid->id != 1) > > > > > > > > > > in cgroup.c::cgroup_init_idr(). > > > > > > > > > > > > > Why ?? > > > > > > > Just to make sure that the root css has id==1. mem_cgroup_is_rootid() make > > > use of the fact. > > > I'm sorry if I miss something. > > > > > > > Hmm. The function allocating ID does > > > > 4530 static struct css_id *get_new_cssid(struct cgroup_subsys *ss, int depth) > > 4531 { > > == > > 4546 spin_lock(&ss->id_lock); > > 4547 /* Don't use 0. allocates an ID of 1-65535 */ > > 4548 error = idr_get_new_above(&ss->idr, newid, 1, &myid); > > 4549 spin_unlock(&ss->id_lock); > > == > > > > and allocates ID above "1", always. > > > > Adding BUG_ON(newid->id != 1) will mean that we doubt the bitmap function and > > consider possibility that new->id == 0. > > > > But, we're 100% sure that it never happens. > > > > I don't think adding a comment is a right thing to do. > > > Okey, I don't have strong requirement to add BUG_ON() anyway. > > These patches looks good to me except for some minor points I've commented. > Thank you for review. I'll repost after applying your feedback. -Kame -- 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