-
Notifications
You must be signed in to change notification settings - Fork 5.8k
JDK-8281015: Further simplify NMT backend #7283
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
👋 Welcome back stuefe! A progress list of the required criteria for merging this PR into |
Tested at SAP for 14 days, no problems. Any opinions? Should I reduce this patch, or split it into parts to make it more palatable? |
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.
Overall is good, a few minor comments.
// Never turned on | ||
if (level == NMT_off || memblock == NULL) { |
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.
Wanna add assert memblock != NULL
?
uint8_t _flags; | ||
uint8_t _unused; | ||
const size_t _size; | ||
const uint32_t _mst_marker; |
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.
make mst_marker a struct? instead of opaque type.
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.
I played around a lot with different forms (struct, union) and in the end settled on an opaque uint32 since
- it would be passed by value and I would have to provide that structure in all kind places, I got include circularities
- I have a vague improvement in my head where we store the malloc site table entries not as individually malloced elements but in a (dynamically growing) array; that would mean we could address them by index without having to walk the bucket chains; and that index would be a simple number.
@tstuefe this pull request can not be integrated into git checkout nmt-cleanups
git fetch https://git.openjdk.java.net/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
Thanks a lot, @zhengyu123, for your review. Sorry for the delay, I had vacation. I'll implement all your proposals excluding the last one (mst_marker as structure); see comment there. |
@tstuefe This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 7 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
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.
please check copyright years, e.g. src/hotspot/share/services/memTracker.cpp (still 2021).
Otherwise looks okay to me.
Thank you @MBaesken ! I will fix copyrights before pushing. |
/integrate |
Going to push as commit b96b743.
Your commit was automatically rebased without conflicts. |
NMT backend can be further simplified and cleaned out.
MemTracker::malloc_header_size(level)
+MemTracker::malloc_footer_size(level)
are fused intoMemTracker::overhead_per_malloc()
MallocSiteTable
, caller gets back a shortcut to the entry. That shortcut is stored verbatim in the malloc header. It consists of two 16-bit values (bucket index and chain position). That tupel finds its way into many argument lists. It can be simplified into single 32-bit opaque marker. Code outside the MallocSiteTable does not need to know what it is.MallocHeader
class contains a lot of logic. It accounts (in constructor) and de-accounts (inMallocHeader::release()
). It would simplify code ifMallocHeader
were just a dumb data carrier and theMallocTracker
would do the actual work.MallocHeader
can be simplified, almost all members made constant and modifying accessors removed.MemTracker::tracking_level() != NMT_off
can be simplified toMemTracker::enabled()
.Testing:
Note that I wanted to manually verify that the gdb "call pp" command still works in order to not break Zhengyu's recent addition, but found its already broken. I filed https://bugs.openjdk.java.net/browse/JDK-8281023 and am preparing a separate patch.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7283/head:pull/7283
$ git checkout pull/7283
Update a local copy of the PR:
$ git checkout pull/7283
$ git pull https://git.openjdk.java.net/jdk pull/7283/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 7283
View PR using the GUI difftool:
$ git pr show -t 7283
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7283.diff