From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756219AbdJJMUC (ORCPT ); Tue, 10 Oct 2017 08:20:02 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7541 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756036AbdJJMTs (ORCPT ); Tue, 10 Oct 2017 08:19:48 -0400 Subject: Re: [PATCH] perf/ftrace : Fix repetitious traces when specify a target task To: Peter Zijlstra CC: , , , , , , Steven Rostedt , Jiri Olsa References: <1507598379-148309-1-git-send-email-cj.chengjian@huawei.com> <20171010113321.rq7w2kb77vyf6qoj@hirez.programming.kicks-ass.net> From: "chengjian (D)" Message-ID: Date: Tue, 10 Oct 2017 20:18:13 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20171010113321.rq7w2kb77vyf6qoj@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.219.85] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.59DCBAB1.0129,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 6361dc66cb169efe010bb5cf91323dee Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 #include #include 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...