From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753423AbbC0UK6 (ORCPT ); Fri, 27 Mar 2015 16:10:58 -0400 Received: from mail-ie0-f180.google.com ([209.85.223.180]:35438 "EHLO mail-ie0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752427AbbC0UK4 (ORCPT ); Fri, 27 Mar 2015 16:10:56 -0400 Message-ID: <5515B94E.6020706@gmail.com> Date: Fri, 27 Mar 2015 14:10:54 -0600 From: David Ahern User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Don Zickus , Arnaldo Carvalho de Melo CC: linux-kernel@vger.kernel.org, Joe Mario , Jiri Olsa Subject: Re: [PATCH v2] perf tool: Fix ppid for synthesized fork events References: <1427302270-10178-1-git-send-email-dsahern@gmail.com> <20150325191526.GX162412@redhat.com> <551312C0.4060706@gmail.com> <20150326211146.GZ162412@redhat.com> <55147C19.5090302@gmail.com> <20150327131005.GA162412@redhat.com> <55156330.9080607@gmail.com> <20150327142036.GI21510@kernel.org> <20150327194941.GG162412@redhat.com> In-Reply-To: <20150327194941.GG162412@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/27/15 1:49 PM, Don Zickus wrote: > diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c > index 1c8fbc9..7ee3823 100644 > --- a/tools/perf/util/thread.c > +++ b/tools/perf/util/thread.c > @@ -187,6 +187,7 @@ static int thread__clone_map_groups(struct thread *thread, > if (thread->pid_ == parent->pid_) > return 0; There's your answer ... the 2 lines above. > > + printf("DON:\n"); > /* But this one is new process, copy maps. */ > for (i = 0; i < MAP__NR_TYPES; ++i) > if (map_groups__clone(thread->mg, parent->mg, i) < 0) > > before David's patch, we do _not_ see any DON markers. After David's patch > we see a 1:1 match of DON markers to the number of threads currently running > in the system. Your "speed up" is based on the assumption that all synthesized threads are their own parent which is wrong. ie., ppid != tgid of the process. Before ppid was getting initialized to -1. If you just make that change to revert to the -1: diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index d5efa5092ce6..ce4ca061c2e5 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -150,8 +150,8 @@ static int perf_event__synthesize_fork(struct perf_tool *tool, { memset(&event->fork, 0, sizeof(event->fork) + machine->id_hdr_size); - event->fork.ppid = tgid; - event->fork.ptid = tgid; + event->fork.ppid = -1; + event->fork.ptid = -1; event->fork.pid = tgid; event->fork.tid = pid; event->fork.header.type = PERF_RECORD_FORK; You see the "DON" messages. David