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

(0.37) Handle continuation scanning in pending to be mounted case #17046

Merged
merged 2 commits into from
Mar 28, 2023

Conversation

LinHu2016
Copy link
Contributor

@LinHu2016 LinHu2016 commented Mar 28, 2023

In order to reduce performance impact, we use one way synchronization
(concurrent continuation scan block continuation mount and skip the
concurrent continuation scan during mounted) between concurrent scanning
and continuation mounting instead of using full mutex.
But there would be a pending to be mounted case when a concurrent scan
block the mounting, during pending to be mounted, another concurrent
scan from different collector could be skipped, plus pending to be
mounted would cause the mounting thread release the vm access during
waiting, there might be race case for vm access between STW collector
and require back from the mounting thread, then the mounting thread
might stay ending to be mounted and the related continuation scan for
the STW collector would be skipped.

also there might be small gap between checking for last unmount and
other concurrent scan conditions, it could cause a race between
concurrent scanning and clean up the related java stacks.

new flags are added in J9VMContinuation->state
bit0 (0x1) for continuation is started -- after first mount
bit1 (0x2) for continuation is finished -- after last unmount
bit2 (0x4) for continuation is pending to be mounted
bit3 (0x8) for continuation is currently scanned by concurrent local gc
bit4 (0x10)for continuation is currently scanned by concurrent global gc
bit8-63 for mounted carrierthread ID

scan continuation object during pending to be mounted

defer conpensating scan(premountContinuation) after
synchronizeWithConcurrentGCScan() to cover the missing scan due to
mounting.

checking bit0 and bit1 to avoid scanning the continuations before
first mount and after last unmount.

update identifying concurrentScavenger is currently active,
for GC threads, need to use scavenger->isCurrentPhaseConcurrent()
instead of isConcurrentScavengerInProgress()(InProgress also includes
STW phases such as oncurrent_phase_roots,concurrent_phase_complete).

Fix: #16652

backport #17030
backport #16713

In order to reduce performance impact, we use one way synchronization
(concurrent continuation scan block continuation mount and skip the
concurrent continuation scan during mounted) between concurrent scanning
and continuation mounting instead of using full mutex.
But there would be a pending to be mounted case when a concurrent scan
block the mounting, during pending to be mounted, another concurrent
 scan from different collector could be skipped, plus pending to be
mounted would cause the mounting thread release the vm access during
waiting, there might be race case for vm access between STW collector
and require back from the mounting thread, then the mounting thread
might stay ending to be mounted and the related continuation scan for
the STW collector would be skipped.

also there might be small gap between checking for last unmount and
other concurrent scan conditions, it could cause a race between
concurrent scanning and clean up the related java stacks.

 - new flags are added in J9VMContinuation->state
bit0 (0x1) for continuation is started -- after first mount
bit1 (0x2) for continuation is finished -- after last unmount
bit2 (0x4) for continuation is pending to be mounted
bit3 (0x8) for continuation is currently scanned by concurrent local gc
bit4 (0x10)for continuation is currently scanned by concurrent global gc
bit8-63    for mounted carrierthread ID

 - scan continuation object during pending to be mounted
 - defer conpensating scan(premountContinuation) after
   synchronizeWithConcurrentGCScan() to cover the missing scan due to
   mounting.
 - checking bit0 and bit1 to avoid scanning the continuations before
   first mount and after last unmount.
 - update identifying concurrentScavenger is currently active,
   for GC threads, need to use scavenger->isCurrentPhaseConcurrent()
   instead of isConcurrentScavengerInProgress()(InProgress also includes
   STW phases such as oncurrent_phase_roots,concurrent_phase_complete).
 - calling postUnmountContinuation() compensating scan after
   resetContinuationCarrierID() to prevent the scan happens before
   resetContinuationCarrierID()(the state still shows the continuation
   is mounted).

Signed-off-by: Lin Hu <linhu@ca.ibm.com>
function isCurrentPhaseConcurrent() is only available under
OMR_GC_CONCURRENT_SCAVENGER.

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

Pls use the title and description from #16713 for this PR so looking at the PR provides more information about the change going in. "backport GC changes for Java 19" doesn't tell us much.

@pshipton
Copy link
Member

Example:

Title: (0.37) Handle continuation scanning in pending to be mounted case

Description:

Details copied from #16713

Fix: #16652

backport #17030
backport #16713

@LinHu2016 LinHu2016 changed the title backport GC changes for Java 19 (0.37) Handle continuation scanning in pending to be mounted case Mar 28, 2023
@pshipton pshipton added comp:gc project:loom Used to track Project Loom related work labels Mar 28, 2023
@pshipton pshipton merged commit 3e02aba into eclipse-openj9:v0.37.0-release Mar 28, 2023
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.

3 participants