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 that occur due
to blocking operations during restore in CRIU single
thread mode.

Issue: eclipse-openj9/openj9#18749
Signed-off-by: Amarpreet Singh <Amarpreet.A.Singh@ibm.com>
  • Loading branch information
singh264 committed Jan 12, 2024
1 parent d89d744 commit 8b5f072
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion closed/GensrcJ9JCL.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ===========================================================================
# (c) Copyright IBM Corp. 2020, 2023 All Rights Reserved
# (c) Copyright IBM Corp. 2020, 2024 All Rights Reserved
# ===========================================================================
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
Expand Down 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/misc/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/share/classes/sun/security/provider/DigestBase.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. 2024, 2024 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 8b5f072

Please sign in to comment.