Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755286Ab3HFHTx (ORCPT ); Tue, 6 Aug 2013 03:19:53 -0400 Received: from mail.bmw-carit.de ([62.245.222.98]:51144 "EHLO mail.bmw-carit.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754953Ab3HFHTw (ORCPT ); Tue, 6 Aug 2013 03:19:52 -0400 X-CTCH-RefID: str=0001.0A0C0202.5200A393.00C6,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 Message-ID: <5200A391.9030208@bmw-carit.de> Date: Tue, 6 Aug 2013 09:19:45 +0200 From: Daniel Wagner User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Tejun Heo CC: , , , , Peter Zijlstra , Ingo Molnar , Johannes Weiner , Michal Hocko , Balbir Singh , Aristeu Rozanski , Matt Helsley , Vivek Goyal , Jens Axboe , Steven Rostedt Subject: Re: [PATCH v2 08/23] cgroup: pass around cgroup_subsys_state instead of cgroup in subsystem methods References: <1375393801-4817-1-git-send-email-tj@kernel.org> <1375393801-4817-9-git-send-email-tj@kernel.org> <20130802202408.GH29736@mtj.dyndns.org> In-Reply-To: <20130802202408.GH29736@mtj.dyndns.org> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.101.5] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3078 Lines: 74 On 08/02/2013 10:24 PM, Tejun Heo wrote: > cgroup is currently in the process of transitioning to using struct > cgroup_subsys_state * as the primary handle instead of struct cgroup * > in subsystem implementations for the following reasons. > > * With unified hierarchy, subsystems will be dynamically bound and > unbound from cgroups and thus css's (cgroup_subsys_state) may be > created and destroyed dynamically over the lifetime of a cgroup, > which is different from the current state where all css's are > allocated and destroyed together with the associated cgroup. This > in turn means that cgroup_css() should be synchronized and may > return NULL, making it more cumbersome to use. > > * Differing levels of per-subsystem granularity in the unified > hierarchy means that the task and descendant iterators should behave > differently depending on the specific subsystem the iteration is > being performed for. > > * In majority of the cases, subsystems only care about its part in the > cgroup hierarchy - ie. the hierarchy of css's. Subsystem methods > often obtain the matching css pointer from the cgroup and don't > bother with the cgroup pointer itself. Passing around css fits > much better. > > This patch converts all cgroup_subsys methods to take @css instead of > @cgroup. The conversions are mostly straight-forward. A few > noteworthy changes are > > * ->css_alloc() now takes css of the parent cgroup rather than the > pointer to the new cgroup as the css for the new cgroup doesn't > exist yet. Knowing the parent css is enough for all the existing > subsystems. > > * In kernel/cgroup.c::offline_css(), unnecessary open coded css > dereference is replaced with local variable access. > > This patch shouldn't cause any behavior differences. > > v2: Unnecessary explicit cgrp->subsys[] deref in css_online() replaced > with local variable @css as suggested by Li Zefan. > > Rebased on top of new for-3.12 which includes for-3.11-fixes so > that ->css_free() invocation added by da0a12caff ("cgroup: fix a > leak when percpu_ref_init() fails") is converted too. Suggested > by Li Zefan. > > Signed-off-by: Tejun Heo > Acked-by: Li Zefan > Acked-by: Michal Hocko > Cc: Peter Zijlstra > Cc: Ingo Molnar > Cc: Johannes Weiner > Cc: Balbir Singh > Cc: Aristeu Rozanski > Cc: Matt Helsley > Cc: Daniel Wagner > Cc: Vivek Goyal > Cc: Jens Axboe > Cc: Steven Rostedt netprio and cls part: Acked-By: Daniel Wagner cheers, daniel -- 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/