On 7/29/13 4:29 AM, Adrian Hunter wrote: >> When perf processes the EXIT event the thread is moved to the >> dead_threads >> list. When the SAMPLE event is processed no thread exists for the pid >> so a new >> one is created by machine__findnew_thread. > > In the case of per-cpu recording, it is normal for sample events to > occur after the EXIT event simply because the EXIT event is recorded > while the task is still running (in kernel). It is therefore a mistake > to move the thread to dead_threads just because of the EXIT event. > > Instead the thread should be marked as exiting and not moved to > dead_threads until another thread starts on the same CPU. i.e. a comm, > mmap, fork event with the same tid and same CPU, or any event with a > different tid and same CPU. > Interesting idea -- delaying the move to the dead-threads list. Following solves the problem as well.