From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761669AbXEJVWI (ORCPT ); Thu, 10 May 2007 17:22:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1762099AbXEJVVz (ORCPT ); Thu, 10 May 2007 17:21:55 -0400 Received: from smtp-out.google.com ([216.239.33.17]:53021 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755785AbXEJVVx (ORCPT ); Thu, 10 May 2007 17:21:53 -0400 DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=received:message-id:date:from:to:subject:cc:in-reply-to: mime-version:content-type:content-transfer-encoding: content-disposition:references; b=AVJLQWiHbUWU83N7gpAsST2KENYr7m7FBLvQON/RDlmxTMJuiZrksVCefcyfC1FXQ 3H0Tf7gDwjQIhvssbQvOQ== Message-ID: <6599ad830705101421t54a2e7eay49713341fcc9faea@mail.gmail.com> Date: Thu, 10 May 2007 14:21:39 -0700 From: "Paul Menage" To: balbir@linux.vnet.ibm.com Subject: Re: [ckrm-tech] [PATCH 3/9] Containers (V9): Add tasks file interface Cc: vatsa@in.ibm.com, svaidy@linux.vnet.ibm.com, ckrm-tech@lists.sourceforge.net, balbir@in.ibm.com, haveblue@us.ibm.com, xemul@sw.ru, linux-kernel@vger.kernel.org, containers@lists.osdl.org, pj@sgi.com, ebiederm@xmission.com, mbligh@google.com, rohitseth@google.com, serue@us.ibm.com, akpm@linux-foundation.org, dev@sw.ru, devel@openvz.org In-Reply-To: <46408E58.7090306@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070427104607.252541000@menage.corp.google.com> <20070427111300.406327000@menage.corp.google.com> <46378311.6000703@linux.vnet.ibm.com> <6599ad830705011337r6f200baen841919ac17c6f38b@mail.gmail.com> <20070502032541.GA7311@in.ibm.com> <6599ad830705012025r64eed906sebe4b38d9977c036@mail.gmail.com> <46408E58.7090306@linux.vnet.ibm.com> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On 5/8/07, Balbir Singh wrote: > > I now have a use case for maintaining a per-container task list. > I am trying to build a per-container stats similar to taskstats. > I intend to support container accounting of > > 1. Tasks running > 2. Tasks stopped > 3. Tasks un-interruptible > 4. Tasks blocked on IO > 5. Tasks sleeping > > This would provide statistics similar to the patch that Pavel had sent out. > > I faced the following problems while trying to implement this feature > > 1. There is no easy way to get a list of all tasks belonging to a container > (we need to walk all threads) Well, walking the taks list is pretty easy - but yes, it could become inefficient when there are many small containers in use. I've got some ideas for a way of tracking this specifically for containers with subsystems that want this, while avoiding the overhead for subsystems that don't really need it. I'll try to add them to the next patchset. > 2. There is no concept of a container identifier. When a user issues a command > to extract statistics, the only unique container identifier is the container > path, which means that we need to do a path lookup to determine the dentry > for the container (which gets quite ugly with all the string manipulation) We could just cache the container path permanently in the container, and invalidate it if any of its parents gets renamed. (I imagine this happens almost never.) > > Adding a container id, will make it easier to find a container and return > statistics belonging to the container. Not unreasonable, but there are a few questions that would have to be answered: - how is the container id picked? Like a pid, or user-defined? Or some kind of string? - how would it be exposed to userspace? A generic control file provided by the container filesystem in all container directories? - can you give a more concrete example of how this would actually be useful? For your container stats, it seems that just reading a control file in the container's directory would give you the stats that you want, and userspace already knows the container's name/id since it opened the control file. Paul