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

Minimize continuation Object size in continuation list #17554

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

LinHu2016
Copy link
Contributor

Currently GC maintain the global continuation lists contain all of
"live" continuation Object for releasing native resource(exceptional
case), jvmti retrieving all continuation and JIT code cache reclaim
processing.
keep less items in the list would reduce time to refresh/iterate the list.

  • new Java Option -XXgc:AddContinuationInListOnFirstMount (default, would not add unstarted continuation in the list) and -XXgc:AddContinuationInListOnCreated.
  • remove not only "dead" but also finished continuation during refreshing list.

@LinHu2016 LinHu2016 marked this pull request as ready for review June 28, 2023 12:37
{
Assert_MM_true(NULL != object);
MM_EnvironmentBase *env = MM_EnvironmentBase::getEnvironment(vmThread->omrVMThread);
if (MM_GCExtensions::onFirstMount == MM_GCExtensions::getExtensions(env)->timingAddContinuationInList) {
Copy link
Contributor

Choose a reason for hiding this comment

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

let's rename this enum to onStarted to be consistent with the rest of related APIs/states

@@ -325,7 +327,7 @@ MM_MarkingSchemeRootClearer::scanContinuationObjects(MM_EnvironmentBase *env)
while (NULL != object) {
gcEnv->_markJavaStats._continuationCandidates += 1;
omrobjectptr_t next = _extensions->accessBarrier->getContinuationLink(object);
if (_markingScheme->isMarked(object)) {
if (_markingScheme->isMarked(object) && !VM_VMHelpers::isContinuationFinished((J9VMThread *)env->getLanguageVMThread(), object)) {
Copy link
Contributor

@amicic amicic Jul 5, 2023

Choose a reason for hiding this comment

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

why did you create this helper - just for being concise?
we already used VM_ContinuationHelpers::isFinished() directly in MM_GCExtensions::releaseNativesForContinuationObject

Copy link
Contributor

Choose a reason for hiding this comment

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

more importantly, why did you create it in VM_VMHelpers (we recently moved out bunch of Continuation specific ones to VM_ContinuationHelpers)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the code was started before we merged the changes(move out Continuation specific ones to VM_ContinuationHelpers)

@@ -3543,7 +3544,7 @@ MM_CopyForwardScheme::scanContinuationObjects(MM_EnvironmentVLHGC *env)
*/
MM_ForwardedHeader forwardedHeader(pointer, _extensions->compressObjectReferences());
J9Object* forwardedPtr = forwardedHeader.getForwardedObject();
Copy link
Contributor

Choose a reason for hiding this comment

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

Move '*' next to variable (as opposed to next to type). Fix it for this method or any other method you that you've touched.

} else {
omrobjectptr_t forwardedPtr = forwardedHeader.getForwardedObject();
Assert_GC_true_with_message(env, NULL != forwardedPtr, "Continuation object %p should be forwarded\n", object);
Copy link
Contributor

Choose a reason for hiding this comment

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

this assert might be too late - we might have already dereferenced forwardedPtr as part of isContinuationFinished, perhaps move it just after getForwardedObject?

@LinHu2016 LinHu2016 force-pushed the GC_Loom_update_19 branch 2 times, most recently from a8ee2a5 to 7ab2479 Compare July 5, 2023 21:04
@@ -43,6 +43,9 @@
#include "ute.h"
#include "AtomicSupport.hpp"
#include "ObjectAllocationAPI.hpp"
#if JAVA_SPEC_VERSION >= 19
#include "ContinuationHelpers.hpp"
#endif /* JAVA_SPEC_VERSION >= 19 */
Copy link
Contributor

Choose a reason for hiding this comment

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

is this still required?

@LinHu2016 LinHu2016 force-pushed the GC_Loom_update_19 branch 5 times, most recently from 058f7c4 to eeb7708 Compare July 6, 2023 15:48
@amicic
Copy link
Contributor

amicic commented Jul 6, 2023

jenkins test sanity aix,win jdk20

Currently GC maintain the global continuation lists contain all of
 "live" continuation Object for releasing native resource(exceptional
 case), jvmti retrieving all continuation and JIT code cache reclaim
 processing.
keep less items in the list would reduce time to refresh/iterate the
list.
 - new Java Option -XXgc:AddContinuationInListOnStarted (default,
 would not add unstarted continuation in the list) and
  -XXgc:AddContinuationInListOnCreated.
 - remove not only "dead" but also finished continuation during
  refreshing list.

Signed-off-by: Lin Hu <linhu@ca.ibm.com>
@amicic
Copy link
Contributor

amicic commented Jul 6, 2023

jenkins test sanity aix,win jdk20

@amicic amicic added comp:gc project:loom Used to track Project Loom related work labels Jul 10, 2023
@amicic amicic merged commit 4759999 into eclipse-openj9:master Jul 10, 2023
7 checks passed
babsingh added a commit to babsingh/openj9 that referenced this pull request Jul 17, 2023
Related: eclipse-openj9#17554

Currently, the default mode is “onStarted”. This adds the continuation
to the list only when the VirtualThread (or the Continuation) starts.

The “onCreated” mode adds to the list as soon as the VirtualThread
(or the Continuation) object is created. This mode is needed if JVMTI
is used. So, the default is changed to “onCreated” until we can
dynamically determine that JVMTI won’t be used.

With “onStarted” as default, the following failures started to occur
last week:
- eclipse-openj9#17784
- eclipse-openj9#17791 (intermittent)
- eclipse-openj9#17782 (intermittent)

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:gc project:loom Used to track Project Loom related work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants