From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755114AbcGLQUG (ORCPT ); Tue, 12 Jul 2016 12:20:06 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:22246 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751035AbcGLQUD (ORCPT ); Tue, 12 Jul 2016 12:20:03 -0400 X-IBM-Helo: d03dlp03.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 , Nikolay Borisov 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> <5784E586.5090904@kyup.com> <20160712130430.GQ30909@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 21:49:48 +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: <20160712130430.GQ30909@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: 16071216-0012-0000-0000-00001025950B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16071216-0013-0000-0000-000043952F23 Message-Id: <578518A4.80301@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-07-12_08:,, 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-1607120147 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 12 July 2016 06:34 PM, Peter Zijlstra wrote: > On Tue, Jul 12, 2016 at 03:41:42PM +0300, Nikolay Borisov wrote: > >> Namespaces and cgroups are completely orthogonal to one another. > > Then how do you specify what your new 'root' is? Surely you must first > create a cgroup and then confine yourself to that? No need to create cgroup and confine processes to that cgroup. The below check during event filtering will take care: + if (cpuctx->perf_ns != event->perf_ns) + return false; event->perf_ns is set during perf_event_alloc(): + if (current->nsproxy->perf_ns != &init_perf_ns) { + /* + * If we are called from our own perf namespace, set + * event->perf_ns + */ + event->perf_ns = current->nsproxy->perf_ns; + [...] + } > >> Also in the v1 of cgroups it's possible to have a process member of >> more than 1 cgroup. > > Yeah, so? We only care about the perf controller obviously. > -- Regards, Aravinda