From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752554AbcGLJ03 (ORCPT ); Tue, 12 Jul 2016 05:26:29 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:65363 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750779AbcGLJ01 (ORCPT ); Tue, 12 Jul 2016 05:26:27 -0400 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: aravinda@linux.vnet.ibm.com Subject: Re: [RFC PATCH 2/2] perf: Filter events based on perf-namespace To: Peter Zijlstra References: <20160614164530.4192.79560.stgit@aravindap> <20160614164951.4192.66724.stgit@aravindap> <20160627155002.GD30909@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: Aravinda Prasad Date: Tue, 12 Jul 2016 14:56:17 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <20160627155002.GD30909@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16071209-0012-0000-0000-00001024BA67 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16071209-0013-0000-0000-0000439214C3 Message-Id: <5784B7B9.5020901@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-07-12_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607120087 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Regards, Aravinda