mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Don Zickus <dzickus@redhat.com>
To: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	linux-kernel@vger.kernel.org, Joe Mario <jmario@redhat.com>,
	Jiri Olsa <jolsa@redhat.com>
Subject: Re: [PATCH v2] perf tool: Fix ppid for synthesized fork events
Date: Fri, 27 Mar 2015 16:25:24 -0400	[thread overview]
Message-ID: <20150327202524.GJ199787@redhat.com> (raw)
In-Reply-To: <5515B94E.6020706@gmail.com>

On Fri, Mar 27, 2015 at 02:10:54PM -0600, David Ahern wrote:
> 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.

Actually, we originally intended the opposite I think.  We were trying to
get perf to avoid reading /proc/<pid>/maps and do the slow and painful ascii
to binary parsing by re-using a similar map (from a forked parent).

Our speed up may have been implemented incorrectly and dumb luck got us a
speed up, but we didn't mean to assume ppid != tgid, IIRC. :-)

I think your's and acme's explaination makes sense.  As a result, we are ok
with this patch.

You mentioned a v2, splitting up the patch.  I will wait for that patch and
ack it.

Thanks!

Cheers,
Don


> 
> 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

      reply	other threads:[~2015-03-27 20:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-25 16:51 David Ahern
2015-03-25 19:15 ` Don Zickus
2015-03-25 19:55   ` David Ahern
2015-03-25 20:26     ` Don Zickus
2015-03-26 21:11     ` Don Zickus
2015-03-26 21:37       ` David Ahern
2015-03-27 13:10         ` Don Zickus
2015-03-27 14:03           ` David Ahern
2015-03-27 14:20             ` Arnaldo Carvalho de Melo
2015-03-27 19:49               ` Don Zickus
2015-03-27 20:09                 ` Arnaldo Carvalho de Melo
2015-03-27 20:10                 ` David Ahern
2015-03-27 20:25                   ` Don Zickus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150327202524.GJ199787@redhat.com \
    --to=dzickus@redhat.com \
    --cc=acme@kernel.org \
    --cc=dsahern@gmail.com \
    --cc=jmario@redhat.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome