Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756564AbbDXP0T (ORCPT ); Fri, 24 Apr 2015 11:26:19 -0400 Received: from mail-qg0-f42.google.com ([209.85.192.42]:36636 "EHLO mail-qg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756128AbbDXP0R (ORCPT ); Fri, 24 Apr 2015 11:26:17 -0400 Date: Fri, 24 Apr 2015 11:26:13 -0400 From: Tejun Heo To: Aleksa Sarai Cc: lizefan@huawei.com, mingo@redhat.com, peterz@infradead.org, richard@nod.at, =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH v10 4/4] cgroups: implement the PIDs subsystem Message-ID: <20150424152613.GB24029@htj.duckdns.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1285 Lines: 43 Hello, Aleksa. On Sat, Apr 25, 2015 at 12:07:34AM +1000, Aleksa Sarai wrote: > Would something like this suffice? > > struct cgroup_subsys_state *task_get_css(struct task_struct *task, int > subsys_id) { > bool have_ref = false; > struct cgroup_subsys_state *css; > > while(!have_ref) { > rcu_read_lock(); > css = task_css(task, subsys_id); > have_ref = !css_tryget(css); > rcu_read_unlock(); > } > > return css; > } I was thinking why this felt so familiar and realized that I have the patch pending. http://lkml.kernel.org/g/1428350318-8215-8-git-send-email-tj@kernel.org Please feel free to include it in the patch series. I'll sort out the merging later. > Also, as a side note (in the same vein I guess), does a ref on a > css_set give you an implicit ref on a css inside that css_set, or are > those two orthogonal operations? Yes, it does, but if you're gonna depend on that, please document that. Thanks. -- tejun -- 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/