All of lore.kernel.org
 help / color / mirror / Atom feed
From: "chengjian (D)" <cj.chengjian@huawei.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: <mingo@redhat.com>, <acme@kernel.org>,
	<alexander.shishkin@linux.intel.com>,
	<linux-kernel@vger.kernel.org>, <xiexiuqi@huawei.com>,
	<huawei.libin@huawei.com>, Steven Rostedt <rostedt@goodmis.org>,
	Jiri Olsa <jolsa@kernel.org>
Subject: Re: [PATCH] perf/ftrace : Fix repetitious traces when specify a target task
Date: Tue, 10 Oct 2017 20:18:13 +0800	[thread overview]
Message-ID: <adc89b7a-23b6-0b1f-823e-56afa86b8d2d@huawei.com> (raw)
In-Reply-To: <20171010113321.rq7w2kb77vyf6qoj@hirez.programming.kicks-ass.net>

On 2017/10/10 19:33, Peter Zijlstra wrote:
>
> No, this _cannot_ be right. The whole point of the @task argument was to
> deliver the event multiple times -- maybe not to the same event, but it
> needs to be delivered multiple times in some cases. Therefore this is
> broken.
>
> But now you've got me looking at 75e8387685f6, which also looks
> completely insane.
> .
the demo is like this

```cpp
// bug_fork.c
#include <stdio.h>
#include <stdlib.h>

#include <unistd.h>


int main(int argc,char** argv){
     pid_t        pid;

     printf("parent pid = %d\n", getpid( ));

     pid = fork( );

     if(pid < 0)
     {
         perror("fork error");
         exit(-1);
     }
     else if(pid == 0)//  fork return 0 in child process
     {
         printf("child pid = %d\n", getpid( ));
         exit(0);
     }
     else        //  return child pid in parent process
     {
         //sleep(1);
         //count++;
     }

     return EXIT_SUCCESS;
}
```


the parent only wakeup_new child process once, but perf match a lot when 
use per-cpu maped.

In my opition, perf stat use per-thread-map, it will match twice.
sudo perf stat -e sched:sched_wakeup_new ./bug_fork

     parent pid = 86155
     child pid = 86156

     Performance counter stats for './bug_fork':

                  2      sched:sched_wakeup_new

        0.001112926 seconds time elapsed


Does it meen a match for trace parent(86155), a match for trace child(86156)

and what cases should the events be delivered multiple times?


Thanks...

  reply	other threads:[~2017-10-10 12:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10  1:19 [PATCH] perf/ftrace : Fix repetitious traces when specify a target task Cheng Jian
2017-10-10 11:33 ` Peter Zijlstra
2017-10-10 12:18   ` chengjian (D) [this message]
2017-10-10 13:42     ` Peter Zijlstra
2017-10-10 13:04   ` Peter Zijlstra
2017-10-10 15:21     ` Peter Zijlstra
2017-10-10 16:35       ` Steven Rostedt

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=adc89b7a-23b6-0b1f-823e-56afa86b8d2d@huawei.com \
    --to=cj.chengjian@huawei.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=huawei.libin@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=xiexiuqi@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.