-
Notifications
You must be signed in to change notification settings - Fork 147
Move the LogType check inside WriteStats #493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Given the large output of helgrind and drd in #470 (comment) it might be an idea to make a careful study of potential problems, but changes due to that probably belong in a separate PR. |
Indeed, I was trying to resolve Helgrind errors, here, still have a long way to go. This is very tricky even for a simple program like For example, this commit fixes a Helgrind error by introducing a barrier, but it leads to another drd error about barrier destruction (which must be fixed). |
|
I think it's OK to merge, but I have 2 concerns:
I'm not sure but maybe the juggling of |
|
With typical buffer sizes, printing of stats is supposed to be very rare compared to actual algebra processing. I would say that if these locks become a bottleneck, far more performance improvement is available to the user by adjusting buffer sizes, than by locking a bit less (after the early returns, for eg). But indeed, if an argument is added, the lock can go back inside For your second point, I don't know. I just made sure that if there were locks before this change, there are also locks after. |
|
Your suggestion is implemented in 96f040d. This is much cleaner I think. A possible additional cleanup: make defines for par={0,1,2} for the second argument of WriteStats ? |
Very nice, thanks!
I think this is a good idea for readability. |
|
I think now that your comment regarding performance of the original commit was important. Since in WriteStats everything is inside I'll squash these, if you are happy with the current state. |
The updating of AC.LogHandle needs to be protected by MLOCK,MUNLOCK, to avoid data races in tform, so move the check inside WriteStats. We need to add a function argument to do this. Also add defines to replace the arguments of WriteStats in its callers, so it is clear what they mean. Fixes form-dev#470 .
|
Merged. Thanks! |
This allows other code to be included in the lock, in particular to avoid race conditions when temporarity setting
AC.LogHandle = -1when AM.LogType is 1.Fixes #470