From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933248AbcGLMls (ORCPT ); Tue, 12 Jul 2016 08:41:48 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:32774 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750943AbcGLMlr (ORCPT ); Tue, 12 Jul 2016 08:41:47 -0400 Subject: Re: [RFC PATCH 2/2] perf: Filter events based on perf-namespace To: Peter Zijlstra , Aravinda Prasad References: <20160614164530.4192.79560.stgit@aravindap> <20160614164951.4192.66724.stgit@aravindap> <20160627155002.GD30909@twins.programming.kicks-ass.net> <5784B7B9.5020901@linux.vnet.ibm.com> <20160712114734.GL30154@twins.programming.kicks-ass.net> Cc: linux-kernel@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, paulus@samba.org, acme@kernel.org, ebiederm@xmission.com, hbathini@linux.vnet.ibm.com, ananth@in.ibm.com From: Nikolay Borisov Message-ID: <5784E586.5090904@kyup.com> Date: Tue, 12 Jul 2016 15:41:42 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <20160712114734.GL30154@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/12/2016 02:47 PM, Peter Zijlstra wrote: > On Tue, Jul 12, 2016 at 02:56:17PM +0530, Aravinda Prasad wrote: >> >> >> On Monday 27 June 2016 09:20 PM, Peter Zijlstra wrote: >>> On Tue, Jun 14, 2016 at 10:19:51PM +0530, Aravinda Prasad wrote: >>>> Whenever perf tool is executed inside a container, this >>>> patch restricts the events to the perf-namespace in which >>>> the perf tool is executing. >>>> >>>> This patch is based on the existing support available >>>> for tracing with cgroups. >>>> >>>> TODO: >>>> - Avoid code duplication. >>> >>> Can't you, at perf_event_open() time, convert a per-cpu event into a >>> per-cpu-per-cgroup event for these namespace thingies? >>> >>> That seems to immediately and completely remove all that duplication. >> >> Sorry for the delay in the response. >> >> I was looking into a way how a per-cpu event can be converted to >> per-cpu-per-cgroup event at perf_event_open() but could not figure out >> how to do this conversion. The cgroup event expects the fd of the cgroup >> directory in cgroupfs and in this case we don't have any fd passed in. >> Not sure if I am missing anything. > > Would not the current namespace have a link to the correct cgroup? > Wasn't that the entire point of the namespace thing? Namespaces and cgroups are completely orthogonal to one another. Also in the v1 of cgroups it's possible to have a process member of more than 1 cgroup. >