Closed ajschorr closed 9 months ago
To be honest, I suspect that this patch is fine and that there's a weird race condition in my code that this change somehow exposes. I need to work on a test case.
Right, the commit definitely still looks good to me. I can think of a few ways your program could be broken:
ck_sequence_write_begin
. Thanks for your thoughts. I think it's likely the 2nd issue you pointed out where the loss of an implicit fence is revealing a problem. Just trying to figure out the proper fix, although using the atomic increment does seem to fix the problem without much if any loss of performance. This is on x86_64.
So this is a fairly ignorant question, but was that atomic increment giving me the equivalent of a strict memory fence (ck_pr_fence_strict_memory)? It seems like adding one solves my issue, but I'm basically just stabbing in the dark, since I don't usually do this type of coding.
In any case, this does seem to be a problem elsewhere in my code. I can fix it with a call to ck_pr_fence_memory, but oddly the performance hit is pretty bad, whereas the old atomic increment solved the problem with negligible performance impact. But I guess it wasn't quite right. Sigh. Anyway, I'm closing this.
Hi,
I have been using ck 0.4.5 for ages. I decided to try updating to 0.7.0, and my code is now broken. I have traced the problem to commit 3f48bc39fb128e2cda57920b86082719d3b8d004:
commit 3f48bc39fb128e2cda57920b86082719d3b8d004 Author: Emilio G. Cota cota@braap.org Date: Wed Jul 1 17:55:59 2015 -0400
diff --git a/include/ck_sequence.h b/include/ck_sequence.h index 46ceb3b..2aa0184 100644 --- a/include/ck_sequence.h +++ b/include/ck_sequence.h @@ -101,7 +101,7 @@ ck_sequence_write_begin(struct ck_sequence *sq)
It's not obvious to me yet why this breaks my code, but it does. If I retain the 0.7.0 ck distribution but replace only ck_sequence.h with the old version from 0.4.5, then my code works properly again.
Regards, Andy