Re: [PATCH] perf_events: fix event scheduling issues introduced by transactional API (take 2)

From: Stephane Eranian
Date: Wed May 26 2010 - 02:58:23 EST


On Wed, May 26, 2010 at 8:34 AM, Lin Ming <ming.m.lin@xxxxxxxxx> wrote:
> On Tue, 2010-05-25 at 23:32 +0800, Peter Zijlstra wrote:
>> On Tue, 2010-05-25 at 17:02 +0200, Stephane Eranian wrote:
>> > Ok, the patch look good expect it needs:
>> >
>> > static int x86_pmu_commit_txn(const struct pmu *pmu)
>> > {
>> > Â Â Â Â ......
>> > Â Â Â Â /*
>> > Â Â Â Â Â* copy new assignment, now we know it is possible
>> > Â Â Â Â Â* will be used by hw_perf_enable()
>> > Â Â Â Â Â*/
>> > Â Â Â Â memcpy(cpuc->assign, assign, n*sizeof(int));
>> >
>> > Â Â Â Â cpuc->n_txn = 0;
>> >
>> > Â Â Â Â return 0;
>> > }
>> >
>> > Because you always call cancel_txn() even when commit()
>> > succeeds. I don't really understand why. I think it could be
>> > avoided by clearing the group_flag in commit_txn() if it
>> > succeeds. It would also make the logical flow more natural. Why
>> > cancel something that has succeeded. You cancel when you fail/abort.
>>
>> Gah, I forgot about that. I think I suggested to Lin to do that and then
>> promptly forgot.
>
> cancel_txn() clears the transaction flag, so it is needed after both
> success and fail transaction, although the function name is a bit
> misleading.
>
> Peter's patch adds the clear of transaction flag into each
> implementation of ->commit_txn.
>
> So cancel_txn() is only called after fail transaction now.
>
Yes and I think it is less prone to confusion now.
--
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/