lkml.org 
[lkml]   [2016]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 03/10] perf sched timehist: Handle zero sample->tid properly
On Wed, Dec 07, 2016 at 11:06:29AM +0900, Namhyung Kim wrote:
> On Mon, Dec 05, 2016 at 07:52:57PM -0800, David Ahern wrote:
> > On 12/5/16 7:40 PM, Namhyung Kim wrote:
> > > Sometimes samples have tid of 0 but non-0 pid. It ends up having a
> >
> > Any idea how that happens?
>
> It seems that an exiting task wakes up its parent and the parent might
> call wait(2) concurrently. So at the time of calling last schedule(),
> its pid (and tgid) link might be unhashed by the parent and can have 0
> sample->tid and/or sample->pid depending on timing IMHO. Not sure
> anything guarantees that the sample tid/pid is preserved during the
> event. From a quick look I couldn't find..

I found following line in my data file.

$ perf script --time 52460.536907,
swapper 0 [000] 52460.536907: sched:sched_switch: pool:3775 [120] x ==> at-spi2-registr:1961 [120]
7f3963 __schedule (/lib/modules/4.8.3-1-ARCH/build/vmlinux)
7f3d7c schedule (/lib/modules/4.8.3-1-ARCH/build/vmlinux)
280b14 do_exit (/lib/modules/4.8.3-1-ARCH/build/vmlinux)
280fa7 [unknown] (/lib/modules/4.8.3-1-ARCH/build/vmlinux)
7f7cf2 entry_SYSCALL_64_fastpath (/lib/modules/4.8.3-1-ARCH/build/vmlinux)
...

As you can see task 3775 called schedule() during exit but sample tid
was 0. In this case prev_pid is still correct (though it's always pid
in the root namespace) since its number was saved in task_struct at the
time of creation and not changed.

I'll change to check prev_pid for idle task.

Thanks,
Namhyung

\
 
 \ /
  Last update: 2016-12-08 15:20    [W:0.060 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site