Skip to content
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

Remove few pointer dereferences in dbuf_read(). #14199

Merged
merged 1 commit into from
Nov 29, 2022

Conversation

amotin
Copy link
Member

@amotin amotin commented Nov 19, 2022

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

@amotin amotin requested a review from behlendorf November 19, 2022 05:00
@amotin amotin added the Status: Code Review Needed Ready for review and testing label Nov 19, 2022
Copy link
Contributor

@ryao ryao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch.

In the past, I would have thought that a good optimizing compiler would have done this for us. However, since there are function calls between where we say to do the pointer dereferences and where the result is used, a compiler might think that the placement was intentional, since a function call might have a side effect that changes the value, which would make moving the dereferences across function calls generate incorrect code. This performance tweak therefore needs to be done manually. This would not have occurred to me unless I were studying the disassembly of this function, which is something I am unlikely to ever do.

@amotin
Copy link
Member Author

amotin commented Nov 20, 2022

This would not have occurred to me unless I were studying the disassembly of this function, which is something I am unlikely to ever do.

@ryao Obviously I am not disassembling everything, but this I've noticed in instruction-level profiles of some benchmarks, which I am sometimes reviewing close for some particularly hot functions.

@amotin amotin force-pushed the deref branch 2 times, most recently from 5ed939d to df23df8 Compare November 20, 2022 20:44
Signed-off-by:  Alexander Motin <mav@FreeBSD.org>
@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Nov 29, 2022
@behlendorf behlendorf merged commit fd61b2e into openzfs:master Nov 29, 2022
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Dec 16, 2022
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Closes openzfs#14199
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Dec 17, 2022
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Closes openzfs#14199
amotin added a commit to amotin/zfs that referenced this pull request Mar 2, 2023
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Closes openzfs#14199
behlendorf pushed a commit that referenced this pull request Mar 2, 2023
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Closes #14199
@amotin amotin deleted the deref branch October 9, 2023 13:22
tsoome pushed a commit to tsoome/illumos-gate that referenced this pull request Nov 11, 2024
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Closes #14199
openzfs/zfs#14199

Change-Id: I73642a34711d27a43d5dd18e6fe5342570039af2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants