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

8252104: parallel heap inspection for ShenandoahHeap #67

Closed
wants to merge 1 commit into from

Conversation

linzang
Copy link
Contributor

@linzang linzang commented Sep 8, 2020

  • enable parallel heap inspecton for ShenandoahHeap
    • preliminary evaluation:
      Time of jmap histo on (8GB heap with 4GB objects)
      • before: 5.186s
      • after : 1.698s

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8252104: parallel heap inspection for ShenandoahHeap

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/67/head:pull/67
$ git checkout pull/67

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 8, 2020

👋 Welcome back lzang! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 8, 2020
@openjdk
Copy link

openjdk bot commented Sep 8, 2020

@linzang The following labels will be automatically applied to this pull request: hotspot-gc shenandoah.

When this pull request is ready to be reviewed, an RFR email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label (add|remove) "label" command.

@openjdk openjdk bot added hotspot-gc hotspot-gc-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Sep 8, 2020
@linzang
Copy link
Contributor Author

linzang commented Sep 8, 2020

/label add "serviceablility"

@openjdk
Copy link

openjdk bot commented Sep 8, 2020

@linzang Usage: /label <add|remove> [label[, label, ...]]wherelabel` is an additional classification that should be applied to this PR. These labels are valid:

  • serviceability
  • hotspot
  • sound
  • hotspot-compiler
  • kulla
  • i18n
  • shenandoah
  • jdk
  • javadoc
  • 2d
  • security
  • swing
  • hotspot-runtime
  • jmx
  • build
  • nio
  • beans
  • core-libs
  • compiler
  • net
  • hotspot-gc
  • hotspot-jfr
  • awt

@linzang
Copy link
Contributor Author

linzang commented Sep 8, 2020

/label add serviceability

@openjdk openjdk bot added the serviceability serviceability-dev@openjdk.org label Sep 8, 2020
@openjdk
Copy link

openjdk bot commented Sep 8, 2020

@linzang
The serviceability label was successfully added.

@mlbridge
Copy link

mlbridge bot commented Sep 8, 2020

Webrevs

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

Thanks, this looks interesting.

I need more time to digest this. It feels like we can merge together the parallel (new) and serial (old) heap iteration code for better maintainability. I could try to do so later.

@linzang
Copy link
Contributor Author

linzang commented Sep 9, 2020

Thanks @shipilev, This is shenandoah support based on parallel heap inspection enabling in serviceability (tracked with https://bugs.openjdk.java.net/browse/JDK-8215624). hope it is helpful for your review.

@linzang
Copy link
Contributor Author

linzang commented Sep 11, 2020

Hi @shipilev,
I have update a PR that trying to reuse code in serial and parallel heap iteration.
would you like to review again? Thanks
-Lin

@shipilev
Copy link
Member

Thank you, we'll take a look next week.

@zhengyu123
Copy link
Contributor

Hi Lin,

  1. The patch does not compile with assertion on
    @@ -1490,7 +1490,7 @@ private:
    cl->do_object(obj);
    obj->oop_iterate(&oops);
    }
  • assert(q.is_empty(), "should be empty");
  • assert(q->is_empty(), "should be empty");
  1. I don't like to export following methods as public. Instead, you can declare ShenandoahParallelObjectIterator as friend class of ShenandoahHeap.
    void scan_roots_for_iteration(Stack<oop, mtGC>* oop_stack, ObjectIterateScanRootClosure* oops);
    bool prepare_aux_bitmap_for_iteration();
    void reclaim_aux_bitmap_for_iteration();

  2. Please rename ObjectIterateParScanClosure to ShenandoahObjectIterateParScanClosure for code convention

  3. There is no point to seed mark roots if prepare_aux_bitmap_for_iteration() failed in ShenandoahParallelObjectIterator constructor.

@linzang
Copy link
Contributor Author

linzang commented Sep 12, 2020

Hi @zhengyu123 ,
Thanks for your comments! I have refined the code and update the PR.
-Lin

@zhengyu123
Copy link
Contributor

Hi @zhengyu123 ,
Thanks for your comments! I have refined the code and update the PR.
-Lin

Looks good to me.
@shipilev may want to take a look.

Thanks.

@openjdk
Copy link

openjdk bot commented Sep 16, 2020

@linzang This change now passes all automated pre-integration checks. In addition to the automated checks, the change must also fulfill all project specific requirements

After integration, the commit message will be:

8252104: parallel heap inspection for ShenandoahHeap

Reviewed-by: shade, zgu
  • If you would like to add a summary, use the /summary command.
  • To credit additional contributors, use the /contributor command.
  • To add additional solved issues, use the /issue command.

Since the source branch of this PR was last updated there have been 148 commits pushed to the master branch:

  • fdce055: 8253253: Binutils tar ball extension update to gz
  • 388c8f2: 8253348: Remove unimplemented JNIHandles::initialize
  • bca9e55: 8253167: ARM32 builds fail after JDK-8247910
  • cc7521c: 8252199: Reimplement support of Type 1 fonts without MappedByteBuffer
  • 3d88d38: 8252070: Some platform-specific BLIT optimizations are not effective
  • 83b0537: 8253291: bug7072653.java still failed "Popup window height ... is wrong"
  • d27835b: 8249142: java/awt/FontClass/CreateFont/DeleteFont.sh is unstable
  • 1438ce0: 8252188: Crash in OrINode::Ideal(PhaseGVN*, bool)+0x8b9
  • 224a30f: 8252311: AArch64: save two words in itable lookup stub
  • 22f7af7: 8253317: The "com/apple/eawt" is missed in the "othervm.dirs" config option
  • ... and 138 more: https://git.openjdk.java.net/jdk/compare/d0f4366a859dd7ba9243495dadb460e78ad27006...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid automatic rebasing, please merge master into your branch, and then specify the current head hash when integrating, like this: /integrate fdce055a9b487afa62a0f67861c786d071aea878.

As you do not have Committer status in this projectan existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@shipilev, @zhengyu123) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 16, 2020
Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

Sorry for the delay! I think there is a concurrency bug in using Stack from multiple threads. Plus, there are a bunch of stylistic nits.

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Outdated Show resolved Hide resolved
src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Outdated Show resolved Hide resolved
src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Outdated Show resolved Hide resolved
if (!_aux_bitmap_region_special && !os::uncommit_memory((char*)_aux_bitmap_region.start(), _aux_bitmap_region.byte_size())) {
log_warning(gc)("Could not uncommit native memory for auxiliary marking bitmap for heap iteration");
// Reset bitmap
_aux_bit_map.clear();
Copy link
Member

Choose a reason for hiding this comment

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

Wait a sec, we have just uncommitted the aux bitmap, so clear() is bound to crash?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, here the aux_bit_map.clear() is called after commit_memory(), so clear() is safe to reset the bitmap.
the uncommit_memory() was moved to reclaim_aux_bitmap_for_iteration() at line 1354

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Outdated Show resolved Hide resolved
src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Outdated Show resolved Hide resolved
src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Outdated Show resolved Hide resolved
src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Outdated Show resolved Hide resolved
src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Outdated Show resolved Hide resolved
@linzang
Copy link
Contributor Author

linzang commented Sep 21, 2020

Dear @shipilev,
I have updated the patch, would you like to help review again? Thanks!

-Lin

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

Thanks, this looks very good. I have only a few minor stylistic leftovers. Other than that, it seems ready to integrate.

}
};

ParallelObjectIterator* ShenandoahHeap::parallel_object_iterator(uint num_workers) {
Copy link
Member

Choose a reason for hiding this comment

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

num_workers -> workers

@@ -549,6 +556,8 @@ class ShenandoahHeap : public CollectedHeap {

// Used for native heap walkers: heap dumpers, mostly
void object_iterate(ObjectClosure* cl);
// Parallel heap iteration support
virtual ParallelObjectIterator* parallel_object_iterator(uint thread_num);
Copy link
Member

Choose a reason for hiding this comment

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

thread_num -> workers

@@ -524,6 +527,10 @@ class ShenandoahHeap : public CollectedHeap {
// Prepare and finish concurrent unloading
void prepare_concurrent_unloading();
void finish_concurrent_unloading();
// Heap iteration support
void scan_roots_for_iteration(Stack<oop, mtGC>* oop_stack, ObjectIterateScanRootClosure* oops);
Copy link
Member

Choose a reason for hiding this comment

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

Let's typedef Stack<oop, mtGC> ShenandoahScanRootStack and use it everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As this Stack is also used for iterating all objects (not only roots), so I took the liberty to rename it to ShenandoahScanObjectStack :)

  - enable parallel heap inspecton for ShenandoahHeap
  - preliminary evaluation:
    Time of jmap histo on (8GB heap with 4GB objects)
    * before: 5.186s
    * after : 1.698s
@linzang
Copy link
Contributor Author

linzang commented Sep 21, 2020

Dear @shipilev,
I just updated the patch. may I ask your help to review and merge it if there is no problem? Thanks!
-Lin

@linzang
Copy link
Contributor Author

linzang commented Sep 21, 2020

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Sep 21, 2020
@openjdk
Copy link

openjdk bot commented Sep 21, 2020

@linzang
Your change (at version a1b6a76) is now ready to be sponsored by a Committer.

@shipilev
Copy link
Member

Thank you, this looks good. I'll run a few local test and then sponsor.

@shipilev
Copy link
Member

/sponsor

@openjdk openjdk bot closed this Sep 21, 2020
@openjdk openjdk bot added integrated Pull request has been integrated and removed sponsor Pull request is ready to be sponsored ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 21, 2020
@openjdk
Copy link

openjdk bot commented Sep 21, 2020

@shipilev @linzang Since your change was applied there have been 148 commits pushed to the master branch:

  • fdce055: 8253253: Binutils tar ball extension update to gz
  • 388c8f2: 8253348: Remove unimplemented JNIHandles::initialize
  • bca9e55: 8253167: ARM32 builds fail after JDK-8247910
  • cc7521c: 8252199: Reimplement support of Type 1 fonts without MappedByteBuffer
  • 3d88d38: 8252070: Some platform-specific BLIT optimizations are not effective
  • 83b0537: 8253291: bug7072653.java still failed "Popup window height ... is wrong"
  • d27835b: 8249142: java/awt/FontClass/CreateFont/DeleteFont.sh is unstable
  • 1438ce0: 8252188: Crash in OrINode::Ideal(PhaseGVN*, bool)+0x8b9
  • 224a30f: 8252311: AArch64: save two words in itable lookup stub
  • 22f7af7: 8253317: The "com/apple/eawt" is missed in the "othervm.dirs" config option
  • ... and 138 more: https://git.openjdk.java.net/jdk/compare/d0f4366a859dd7ba9243495dadb460e78ad27006...master

Your commit was automatically rebased without conflicts.

Pushed as commit 34ec1be.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-gc hotspot-gc-dev@openjdk.org integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org
3 participants