From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751177AbdAQORQ (ORCPT ); Tue, 17 Jan 2017 09:17:16 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:56618 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751076AbdAQORP (ORCPT ); Tue, 17 Jan 2017 09:17:15 -0500 Subject: [PATCH v5 0/3] perf: add support for analyzing events for containers From: Hari Bathini To: ast@fb.com, peterz@infradead.org, lkml , acme@kernel.org, alexander.shishkin@linux.intel.com, mingo@redhat.com Cc: daniel@iogearbox.net, rostedt@goodmis.org, Ananth N Mavinakayanahalli , ebiederm@xmission.com, sargun@sargun.me, Aravinda Prasad , brendan.d.gregg@gmail.com, jolsa@redhat.com Date: Tue, 17 Jan 2017 19:46:58 +0530 User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17011714-0012-0000-0000-00000204C42E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17011714-0013-0000-0000-000006D389ED Message-Id: <148466259095.32153.10361763951552633449.stgit@hbathini.in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-01-17_09:,, 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-1612050000 definitions=main-1701170195 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, there is no trivial mechanism to analyze events based on containers. perf -G can be used, but it will not filter events for the containers created after perf is invoked, making it difficult to assess/ analyze performance issues of multiple containers at once. This patch-set is aimed at addressing this limitation by introducing a new PERF_RECORD_NAMESPACES event that records namespaces related info. As containers are created with namespaces, the new data can be used to in assessment/analysis of multiple containers. The first patch introduces PERF_RECORD_NAMESPACES in kernel while the second patch makes the corresponding changes in perf tool to read this PERF_RECORD_NAMESPACES events. The third patch demonstrates analysis of containers with this data by adding a cgroup identifier column in perf report, which contains the cgroup namespace's device and inode numbers. This is based on the assumption that each container is created with it's own cgroup namespace. The third patch has scope for improvement based on the conventions a container is attributed with, going forward. --- Hari Bathini (3): perf: add PERF_RECORD_NAMESPACES to include namespaces related info perf tool: add PERF_RECORD_NAMESPACES to include namespaces related info perf tool: add cgroup identifier entry in perf report include/linux/perf_event.h | 2 include/uapi/linux/perf_event.h | 38 +++++++++ kernel/events/core.c | 142 +++++++++++++++++++++++++++++++++ kernel/fork.c | 3 + kernel/nsproxy.c | 5 + tools/include/uapi/linux/perf_event.h | 38 +++++++++ tools/perf/builtin-annotate.c | 1 tools/perf/builtin-diff.c | 1 tools/perf/builtin-inject.c | 14 +++ tools/perf/builtin-kmem.c | 1 tools/perf/builtin-kvm.c | 2 tools/perf/builtin-lock.c | 1 tools/perf/builtin-mem.c | 1 tools/perf/builtin-record.c | 33 +++++++- tools/perf/builtin-report.c | 1 tools/perf/builtin-sched.c | 1 tools/perf/builtin-script.c | 41 +++++++++ tools/perf/builtin-trace.c | 3 - tools/perf/perf.h | 1 tools/perf/util/Build | 1 tools/perf/util/data-convert-bt.c | 2 tools/perf/util/event.c | 143 ++++++++++++++++++++++++++++++++- tools/perf/util/event.h | 19 ++++ tools/perf/util/evsel.c | 3 + tools/perf/util/hist.c | 7 ++ tools/perf/util/hist.h | 1 tools/perf/util/machine.c | 34 ++++++++ tools/perf/util/machine.h | 3 + tools/perf/util/namespaces.c | 27 ++++++ tools/perf/util/namespaces.h | 18 ++++ tools/perf/util/session.c | 7 ++ tools/perf/util/sort.c | 41 +++++++++ tools/perf/util/sort.h | 7 ++ tools/perf/util/thread.c | 44 ++++++++++ tools/perf/util/thread.h | 6 + tools/perf/util/tool.h | 2 36 files changed, 679 insertions(+), 15 deletions(-) create mode 100644 tools/perf/util/namespaces.c create mode 100644 tools/perf/util/namespaces.h