-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Micro-optimize zrl_remove(). #14200
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
Micro-optimize zrl_remove(). #14200
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the micro-optimization here just reduced register pressure from the compiler not having to worry about a register being clobbered with the result, or is there some micro-architectural detail of how these operations work that make one more expensive than the other beyond the register pressure from one version clobbering a register?
For reference, in the FreeBSD source code on amd64, atomic_dec_32_nv()
becomes atomic_fetchadd_int()
and atomic_dec_32()
becomes atomic_subtract_int()
. The relevant lines are:
@ryao It was |
@amotin would you mind rebasing and force updating this PR. That should hopefully clear up the checkstyle failure at least. |
atomic_dec_32() should be a bit lighter than atomic_dec_32_nv(). Signed-off-by: Alexander Motin <[email protected]>
@behlendorf done. |
atomic_dec_32() should be a bit lighter than atomic_dec_32_nv(). Reviewed-by: Tino Reichardt <[email protected]> Reviewed-by: Richard Yao <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Closes openzfs#14200
atomic_dec_32() should be a bit lighter than atomic_dec_32_nv(). Reviewed-by: Tino Reichardt <[email protected]> Reviewed-by: Richard Yao <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Closes openzfs#14200
atomic_dec_32() should be a bit lighter than atomic_dec_32_nv(). Reviewed-by: Tino Reichardt <[email protected]> Reviewed-by: Richard Yao <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Closes openzfs#14200
atomic_dec_32() should be a bit lighter than atomic_dec_32_nv(). Reviewed-by: Tino Reichardt <[email protected]> Reviewed-by: Richard Yao <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Closes #14200
atomic_dec_32() should be a bit lighter than atomic_dec_32_nv().
Types of changes
Checklist:
Signed-off-by
.