Re: [PATCH 03/10] perf sched timehist: Handle zero sample->tid properly

From: Namhyung Kim
Date: Tue Dec 06 2016 - 21:21:39 EST


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

If that's true we need to somehow make sure that sample->tid of 0 is
actually from idle task or not.

Thanks,
Namhyung