Re: [PATCH] perf_events: fix cgrp stale pointer inupdate_cgrp_time_from_cpuctx()

From: Ingo Molnar
Date: Wed Mar 23 2011 - 07:36:28 EST



* Stephane Eranian <eranian@xxxxxxxxxx> wrote:

> - if (is_cgroup_event(event))
> + if (is_cgroup_event(event)) {
> ctx->nr_cgroups--;
> + cpuctx = __get_cpu_context(ctx);
> + /*
> + * if there are no more cgroup events
> + * then clear cgrp to avoid stale pointer
> + * in update_cgrp_time_from_cpuctx()
> + */
> + if (!ctx->nr_cgroups)
> + cpuctx->cgrp = NULL;
> + }

The ->cgrp pointer does not exist on !CGROUPS kernels. I suspect the cleanest
approach would be to make those two cgrp fields available unconditionally in
struct perf_event.

Thanks,

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/