From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751949AbcHZEFM (ORCPT ); Fri, 26 Aug 2016 00:05:12 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:46373 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751280AbcHZEFK (ORCPT ); Fri, 26 Aug 2016 00:05:10 -0400 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: ananth@linux.vnet.ibm.com Date: Fri, 26 Aug 2016 09:35:02 +0530 From: Ananth N Mavinakayanahalli To: Hari Bathini Cc: Peter Zijlstra , ast@fb.com, lkml , acme@kernel.org, alexander.shishkin@linux.intel.com, mingo@redhat.com, sargun@sargun.me, Aravinda Prasad , "Naveen N. Rao" , daniel@iogearbox.net Subject: Re: [PATCH 1/2] perf: add container identifier entry in perf sample data Reply-To: ananth@linux.vnet.ibm.com References: <147212627442.20120.6106492652250934757.stgit@hbathini.in.ibm.com> <20160825130139.GF10138@twins.programming.kicks-ass.net> 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) X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16082604-0028-0000-0000-000005745CCC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005641; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000183; SDB=6.00749807; UDB=6.00354050; IPR=6.00522443; BA=6.00004675; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012471; XFM=3.00000011; UTC=2016-08-26 04:05:08 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16082604-0029-0000-0000-00002EAFE525 Message-Id: <20160826040502.GD29746@in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-08-26_02:,, 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-1608260040 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 25, 2016 at 10:50:18PM +0530, Hari Bathini wrote: > > > On Thursday 25 August 2016 06:31 PM, Peter Zijlstra wrote: > >On Thu, Aug 25, 2016 at 05:27:54PM +0530, Hari Bathini wrote: > > > >>diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h > >>index c66a485..fb4f902 100644 > >>--- a/include/uapi/linux/perf_event.h > >>+++ b/include/uapi/linux/perf_event.h > >>@@ -139,8 +139,9 @@ enum perf_event_sample_format { > >> PERF_SAMPLE_IDENTIFIER = 1U << 16, > >> PERF_SAMPLE_TRANSACTION = 1U << 17, > >> PERF_SAMPLE_REGS_INTR = 1U << 18, > >>+ PERF_SAMPLE_CID = 1U << 19, > >>- PERF_SAMPLE_MAX = 1U << 19, /* non-ABI */ > >>+ PERF_SAMPLE_MAX = 1U << 20, /* non-ABI */ > >> }; > >This forgets to update the comment that goes with PERF_RECORD_SAMPLE. > >This patch would also need an update to the manpage: > > > > http://git.kernel.org/cgit/docs/man-pages/man-pages.git/tree/man2/perf_event_open.2 > > > > http://www.man7.org/linux/man-pages/man2/perf_event_open.2.html > > > >>+ if (sample_type & PERF_SAMPLE_CID) { > >>+ int size = sizeof(u64); > >>+ > >>+ /* > >>+ * Container identifier for a given task. > >>+ * Using cgroup namespace inode number for this. > >>+ */ > >>+ data->cid_entry.cid = current->nsproxy->cgroup_ns->ns.inum; > >>+ data->cid_entry.reserved = 0; > >>+ header->size += size; > >>+ } > >> } > >Does this compile with CONFIG_CGROUP=n ? > > > > My bad. Will update.. > Actually, on second thought, how about using inode number of some > other namespace that any container would have (mount, probably?).. I am not sure about every implementation of 'containers' but I would think that the cgroup namespace is the right choice here. Mount namespaces can be potentially shared between containers AFAIK. Ananth