From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756207Ab1HaVyg (ORCPT ); Wed, 31 Aug 2011 17:54:36 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:64159 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755795Ab1HaVya (ORCPT ); Wed, 31 Aug 2011 17:54:30 -0400 Date: Wed, 31 Aug 2011 23:54:26 +0200 From: Frederic Weisbecker To: Paul Menage Cc: Kay Sievers , Li Zefan , Tim Hockin , Andrew Morton , LKML , Johannes Weiner , Aditya Kali , Oleg Nesterov Subject: Re: [RFD] Task counter: cgroup core feature or cgroup subsystem? (was Re: [PATCH 0/8 v3] cgroups: Task counter subsystem) Message-ID: <20110831215423.GF20598@somewhere> References: <1311956010-32076-1-git-send-email-fweisbec@gmail.com> <20110801161900.1fe24b76.akpm@linux-foundation.org> <20110818143319.GC10441@somewhere> <20110824175431.GA26417@somewhere.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 On Fri, Aug 26, 2011 at 08:16:32AM -0700, Paul Menage wrote: > On Wed, Aug 24, 2011 at 10:54 AM, Frederic Weisbecker > wrote: > > > > It seems your patch doesn't handle the ->fork() and ->exit() calls. > > We probably need a quick access to states of multi-subsystems from > > the task, some lists available from task->cgroups, I don't know yet. > > > > That state is available, but currently only while holding cgroup_mutex > - at least, that's what task_cgroup_from_root() requires. > > It might be the case that we could achieve the same effect by just > locking the task, so the pre-condition for task_cgroup_from_root() > would be either that cgroup_mutex is held or the task lock is held. Now I realize, is it necessary if we only want to access a subsys state through task->cgroups->subsys[i] from the ->fork() callback? The task is not yet added to the thread_group, its pid is not yet hashed so I guess it can not concurrently be moved to another cgroup. We need a special flavour of task->cgroups->subsys for multi bindable subsystem but that's the same.