lkml.org 
[lkml]   [2017]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] perf/ftrace : Fix repetitious traces when specify a target task
From
Date
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...


\
 
 \ /
  Last update: 2017-10-10 14:20    [W:0.079 / U:0.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site