Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755577Ab2FNKE5 (ORCPT ); Thu, 14 Jun 2012 06:04:57 -0400 Received: from cantor2.suse.de ([195.135.220.15]:38221 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755541Ab2FNKE4 (ORCPT ); Thu, 14 Jun 2012 06:04:56 -0400 Date: Thu, 14 Jun 2012 12:04:54 +0200 From: Michal Hocko To: "Aneesh Kumar K.V" Cc: linux-mm@kvack.org, kamezawa.hiroyu@jp.fujitsu.com, dhillf@gmail.com, rientjes@google.com, akpm@linux-foundation.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH -V9 14/15] hugetlb/cgroup: migrate hugetlb cgroup info from oldpage to new page during migration Message-ID: <20120614100454.GL27397@tiehlicka.suse.cz> References: <1339583254-895-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1339583254-895-15-git-send-email-aneesh.kumar@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1339583254-895-15-git-send-email-aneesh.kumar@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1608 Lines: 50 On Wed 13-06-12 15:57:33, Aneesh Kumar K.V wrote: > From: "Aneesh Kumar K.V" > > With HugeTLB pages, hugetlb cgroup is uncharged in compound page destructor. Since > we are holding a hugepage reference, we can be sure that old page won't > get uncharged till the last put_page(). > > Signed-off-by: Aneesh Kumar K.V Reviewed-by: Michal Hocko One question below [...] > +void hugetlb_cgroup_migrate(struct page *oldhpage, struct page *newhpage) > +{ > + struct hugetlb_cgroup *h_cg; > + > + if (hugetlb_cgroup_disabled()) > + return; > + > + VM_BUG_ON(!PageHuge(oldhpage)); > + spin_lock(&hugetlb_lock); > + h_cg = hugetlb_cgroup_from_page(oldhpage); > + set_hugetlb_cgroup(oldhpage, NULL); > + cgroup_exclude_rmdir(&h_cg->css); > + > + /* move the h_cg details to new cgroup */ > + set_hugetlb_cgroup(newhpage, h_cg); > + spin_unlock(&hugetlb_lock); > + cgroup_release_and_wakeup_rmdir(&h_cg->css); > + return; > +} > + The changelog says that the old page won't get uncharged - which means that the the cgroup cannot go away (even if we raced with the move parent, hugetlb_lock makes sure we either see old or new cgroup) so why do we need to play with css ref. counting? -- Michal Hocko SUSE Labs SUSE LINUX s.r.o. Lihovarska 1060/12 190 00 Praha 9 Czech Republic -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/