Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752599Ab3FNMzo (ORCPT ); Fri, 14 Jun 2013 08:55:44 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45434 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751779Ab3FNMzm (ORCPT ); Fri, 14 Jun 2013 08:55:42 -0400 Date: Fri, 14 Jun 2013 14:55:39 +0200 From: Michal Hocko To: Glauber Costa Cc: lizefan@huawei.com, containers@lists.linux-foundation.org, cgroups@vger.kernel.org, koverstreet@google.com, linux-kernel@vger.kernel.org, cl@linux-foundation.org, Mike Snitzer , Vivek Goyal , "Alasdair G. Kergon" , Jens Axboe , Mikulas Patocka , Glauber Costa , Tejun Heo Subject: Re: [PATCH 11/11] cgroup: use percpu refcnt for cgroup_subsys_states Message-ID: <20130614125539.GC10084@dhcp22.suse.cz> References: <1371096298-24402-1-git-send-email-tj@kernel.org> <1371096298-24402-12-git-send-email-tj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1371096298-24402-12-git-send-email-tj@kernel.org> 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: 1831 Lines: 42 On Wed 12-06-13 21:04:58, Tejun Heo wrote: [...] > +/** > + * cgroup_destroy_locked - the first stage of cgroup destruction > + * @cgrp: cgroup to be destroyed > + * > + * css's make use of percpu refcnts whose killing latency shouldn't be > + * exposed to userland and are RCU protected. Also, cgroup core needs to > + * guarantee that css_tryget() won't succeed by the time ->css_offline() is > + * invoked. To satisfy all the requirements, destruction is implemented in > + * the following two steps. > + * > + * s1. Verify @cgrp can be destroyed and mark it dying. Remove all > + * userland visible parts and start killing the percpu refcnts of > + * css's. Set up so that the next stage will be kicked off once all > + * the percpu refcnts are confirmed to be killed. > + * > + * s2. Invoke ->css_offline(), mark the cgroup dead and proceed with the > + * rest of destruction. Once all cgroup references are gone, the > + * cgroup is RCU-freed. > + * > + * This function implements s1. After this step, @cgrp is gone as far as > + * the userland is concerned and a new cgroup with the same name may be > + * created. As cgroup doesn't care about the names internally, this > + * doesn't cause any problem. Glauber is this asumption correct for kmem caches naming scheme? I guess it should, but I would rather be sure this won't blow up later specially when caches might live longer than css_offline. > + */ > static int cgroup_destroy_locked(struct cgroup *cgrp) > __releases(&cgroup_mutex) __acquires(&cgroup_mutex) > { -- Michal Hocko SUSE Labs -- 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/