From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753675AbbEAKN5 (ORCPT ); Fri, 1 May 2015 06:13:57 -0400 Received: from terminus.zytor.com ([198.137.202.10]:51946 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753534AbbEAKNw (ORCPT ); Fri, 1 May 2015 06:13:52 -0400 Date: Fri, 1 May 2015 03:13:33 -0700 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: dsahern@gmail.com, mpetlan@redhat.com, jolsa@redhat.com, linux-kernel@vger.kernel.org, bp@suse.de, hpa@zytor.com, acme@redhat.com, fweisbec@gmail.com, eranian@google.com, dzickus@redhat.com, tglx@linutronix.de, adrian.hunter@intel.com, namhyung@kernel.org, mingo@kernel.org Reply-To: mingo@kernel.org, adrian.hunter@intel.com, namhyung@kernel.org, dzickus@redhat.com, eranian@google.com, fweisbec@gmail.com, tglx@linutronix.de, acme@redhat.com, bp@suse.de, hpa@zytor.com, linux-kernel@vger.kernel.org, jolsa@redhat.com, dsahern@gmail.com, mpetlan@redhat.com To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf trace: Disable events and drain events when forked workload ends Git-Commit-ID: 02ac5421ddc634767c732f9b6a10a395a9ecfc4f X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 02ac5421ddc634767c732f9b6a10a395a9ecfc4f Gitweb: http://git.kernel.org/tip/02ac5421ddc634767c732f9b6a10a395a9ecfc4f Author: Arnaldo Carvalho de Melo AuthorDate: Wed, 22 Apr 2015 11:11:57 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 23 Apr 2015 17:08:08 -0300 perf trace: Disable events and drain events when forked workload ends We were not checking in the inner event processing loop if the forked workload had finished, which, on a busy system, may make it take a long time trying to drain events, entering a seemingly neverending loop, waiting for the system to get idle enough to make it drain the buffers. Fix it by disabling the events when 'done' is true, in the inner loop, to start draining what is in the buffers. Now: [root@ssdandy ~]# time trace --filter-pids 14003 -a sleep 1 | tail 996.748 ( 0.002 ms): sh/30296 rt_sigprocmask(how: SETMASK, nset: 0x7ffc83418160, sigsetsize: 8) = 0 996.751 ( 0.002 ms): sh/30296 rt_sigprocmask(how: BLOCK, nset: 0x7ffc834181f0, oset: 0x7ffc83418270, sigsetsize: 8) = 0 996.755 ( 0.002 ms): sh/30296 rt_sigaction(sig: INT, act: 0x7ffc83417f50, oact: 0x7ffc83417ff0, sigsetsize: 8) = 0 1004.543 ( 0.362 ms): tail/30198 ... [continued]: read()) = 4096 1004.548 ( 7.791 ms): sh/30296 wait4(upid: -1, stat_addr: 0x7ffc834181a0) ... 1004.975 ( 0.427 ms): tail/30198 read(buf: 0x7633f0, count: 8192) = 4096 1005.390 ( 0.410 ms): tail/30198 read(buf: 0x765410, count: 8192) = 4096 1005.743 ( 0.348 ms): tail/30198 read(buf: 0x7633f0, count: 8192) = 4096 1006.197 ( 0.449 ms): tail/30198 read(buf: 0x765410, count: 8192) = 4096 1006.492 ( 0.290 ms): tail/30198 read(buf: 0x7633f0, count: 8192) = 4096 real 0m1.219s user 0m0.704s sys 0m0.331s [root@ssdandy ~]# Reported-by: Michael Petlan Suggested-by: Jiri Olsa Acked-by: Jiri Olsa Cc: Adrian Hunter Cc: Borislav Petkov Cc: David Ahern Cc: Don Zickus Cc: Frederic Weisbecker Cc: Namhyung Kim Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-p6kpn1b26qcbe47pufpw0tex@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-trace.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 8842218..e122970 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -2273,6 +2273,11 @@ next_event: if (interrupted) goto out_disable; + + if (done && !draining) { + perf_evlist__disable(evlist); + draining = true; + } } }