Re: [RFC][PATCH] perf_events: Fix FORK events

From: Ingo Molnar
Date: Mon Feb 08 2010 - 02:45:03 EST



* Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> Hi,
>
> While looking into a problem reported by Pekka, I noticed that I wasn't
> receiving any FORK events for a workload that did fork (see attachment).

ah yes, my old testcase for forks.

> After making the below change, stuff started working again, thing is, I'm
> not sure why.

In case it matters: that workload of 4x fork (and the whole fork events
mechanism) was always very sensitive to the precise timing of when a child
and a parent does what, in the final dance of wait(), do_exit(),
release_task(), etc. when a task exits. Especially on SMP systems.

> The main change is sending the FORK event to the parent instead of the
> child thread, however perf_event_fork() is at the end of copy_process(),
> which is after perf_event_init_task() which inherits all the counters, so
> it should all have worked as it was.
>
> We could of course just slam the commit in and not worry about it, but
> that just doesn't feel right.

Would be nice to figure it out ...

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/