Skip to content

Commit

Permalink
Add NotCheckpointSafe annotations to PhantomCleanable
Browse files Browse the repository at this point in the history
Add NotCheckpointSafe annotations to PhantomCleanable to
avoid blocking operations during restore in CRIU single
thread mode, and fix the failures in the
cmdLineTester_criu_nonPortableRestore tests and the
cmdLineTester_criu_nonPortableRestore_Xtrace_outputFile
tests that occur due to blocking operations during restore
in CRIU single thread mode.

Issues: eclipse-openj9/openj9#18399, eclipse-openj9/openj9#18514
Signed-off-by: Amarpreet Singh <Amarpreet.A.Singh@ibm.com>
  • Loading branch information
singh264 committed Nov 24, 2023
1 parent 67b9bcb commit 09c3a13
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions closed/GensrcJ9JCL.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ $(eval $(call SetupCopyFiles,COPY_OVERLAY_FILES, \
src/java.base/share/classes/java/util/TimerTask.java \
src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java \
src/java.base/share/classes/jdk/internal/access/JavaNetInetAddressAccess.java \
src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java \
src/java.base/share/classes/sun/security/jca/ProviderConfig.java \
src/java.base/share/classes/sun/security/jca/ProviderList.java \
src/java.base/unix/classes/java/lang/ProcessEnvironment.java \
Expand Down
18 changes: 18 additions & 0 deletions src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* ===========================================================================
* (c) Copyright IBM Corp. 2023, 2023 All Rights Reserved
* ===========================================================================
*/

package jdk.internal.ref;

Expand All @@ -30,6 +35,10 @@
import java.lang.ref.PhantomReference;
import java.util.Objects;

/*[IF CRIU_SUPPORT]*/
import openj9.internal.criu.NotCheckpointSafe;
/*[ENDIF] CRIU_SUPPORT */

/**
* PhantomCleanable subclasses efficiently encapsulate cleanup state and
* the cleaning action.
Expand Down Expand Up @@ -83,6 +92,9 @@ public PhantomCleanable(T referent, Cleaner cleaner) {
/**
* Insert this PhantomCleanable after the list head.
*/
/*[IF CRIU_SUPPORT]*/
@NotCheckpointSafe
/*[ENDIF] CRIU_SUPPORT */
private void insert() {
synchronized (list) {
prev = list;
Expand All @@ -98,6 +110,9 @@ private void insert() {
* @return true if Cleanable was removed or false if not because
* it had already been removed before
*/
/*[IF CRIU_SUPPORT]*/
@NotCheckpointSafe
/*[ENDIF] CRIU_SUPPORT */
private boolean remove() {
synchronized (list) {
if (next != this) {
Expand All @@ -116,6 +131,9 @@ private boolean remove() {
*
* @return true if the list is empty
*/
/*[IF CRIU_SUPPORT]*/
@NotCheckpointSafe
/*[ENDIF] CRIU_SUPPORT */
boolean isListEmpty() {
synchronized (list) {
return list == list.next;
Expand Down

0 comments on commit 09c3a13

Please sign in to comment.