Re: [PATCH v2 03/14] perf: Add persistent event facilities

From: Peter Zijlstra
Date: Mon Jun 24 2013 - 05:45:15 EST


> +static void del_persistent_event(int cpu, struct perf_event_attr *attr)
> +{
> + struct pers_event_desc *desc, *tmp;
> + struct perf_event *event = NULL;
> +
> + list_for_each_entry_safe(desc, tmp, &per_cpu(pers_events, cpu), plist) {
> + if (desc->attr->config == attr->config) {

attr->config might not be enough; you might also want to compare type,
config1, config2, and possible bp_type as well; although I think we want
to avoid having hwbp style persistent events, but then what do I know.

> + event = desc->event;
> + break;
> + }
> + }
> +
> + if (!event)
> + return;
> +
> + list_del(&desc->plist);
> +
> + perf_event_disable(event);
> + if (event->rb) {
> + rb_put(event->rb);
> + rcu_assign_pointer(event->rb, NULL);
> + }
> +
> + perf_event_release_kernel(event);
> + put_unused_fd(desc->fd);
> + kfree(desc->attr);
> + kfree(desc);
> +}
--
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/