Re: [PATCH v4] perf_counter: Fix race in attaching counters totasks and exiting

From: Paul Mackerras
Date: Thu May 28 2009 - 08:18:34 EST


Peter Zijlstra writes:

> The poor task will now have to wait for yet another RCU grace period,
> but yeah :-)

I moved the put_task_struct into put_ctx, inside the if, so the poor
task won't get impatient. :)

> Looks good, although lockdep will complain, the proper annotation would
> be spin_lock_nested_lock(&ctx->lock, &rq->lock), but since we don't have
> access to the rq here, we should change the second spin_lock, to:
>
> spin_lock_nested(&next_ctx->lock, SINGLE_DEPTH_NESTING);

Ah OK, thanks.

> You jump into an rcu_read_lock() section there.

Oops. I'll fix that. I also need to use spin_[un]lock_irq in there.
New version coming. Thanks for the review.

Paul.
--
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/