Re: [PATCH 2/2] perf_counter: optimize context switch betweenidentical inherited contexts

From: Peter Zijlstra
Date: Mon May 25 2009 - 06:50:19 EST


On Mon, 2009-05-25 at 12:38 +0200, Peter Zijlstra wrote:
> On Mon, 2009-05-25 at 10:15 +1000, Paul Mackerras wrote:
> > Peter Zijlstra writes:
> >
> > > Ingo just pointed out that there is nothing there to close the race with
> > > attaching a counter.
> > >
> > > That is, you could end up attaching your counter to the wrong task.
> >
> > Good point. Doing the unclone in find_get_context would be a start,
> > but the locking could get tricky (in fact we don't have any way to
> > remove an inherited counter from a context, so we only have to worry
> > about counters being attached). I'll work out a solution after I have
> > digested your recent batch of patches.
>
> I'm currently staring at something like the below, trying to find races
> etc.. ;-)
>
> attach vs destroy vs flip

Hmm, it appears we only unclone ctx on remove, not attach.. how odd..
--
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/