Re: [PATCH 8/8][RFC] perf: be paranoid about child times?

From: Ingo Molnar
Date: Mon Nov 23 2009 - 05:52:13 EST



* Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> wrote:

> Normally we flatten the inherited hierarchy by attaching all childs to
> the top parent, therefore a child's child_total_time_* should never
> get incremented, add it anyway?
>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
> ---
> kernel/perf_event.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> Index: linux-2.6/kernel/perf_event.c
> ===================================================================
> --- linux-2.6.orig/kernel/perf_event.c
> +++ linux-2.6/kernel/perf_event.c
> @@ -1780,8 +1780,10 @@ u64 perf_event_read_value(struct perf_ev
>
> list_for_each_entry(child, &event->child_list, child_list) {
> total += perf_event_read(child);
> - *enabled += child->total_time_enabled;
> - *running += child->total_time_running;
> + *enabled += child->total_time_enabled +
> + atomic64_read(&child->child_total_time_enabled);
> + *running += child->total_time_running +
> + atomic64_read(&child->child_total_time_running);

Stick in a WARN_ON_ONCE() instead?

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/