From ee7c3b3d5baee0a4d2de273c753e0b6b4a8b9b42 Mon Sep 17 00:00:00 2001
From: zhangyipeng  <zhangyipeng7@huawei.com>
Date: Fri, 12 Jan 2024 10:53:02 +0800
Subject: [PATCH] [Huawei]Fix for JDK-8137099 for G1 is to not return null until full
 GC has happened
---
 hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index 1ce641cae..84d5d4d8b 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -876,9 +876,10 @@ G1CollectedHeap::mem_allocate(size_t word_size,
       }
       return result;
     } else {
-      if (gclocker_retry_count > GCLockerRetryAllocationCount) {
-        return NULL;
-      }
+      // Fix for JDK-8137099 for G1 is to not return null until full GC has happened
+      // if (gclocker_retry_count > GCLockerRetryAllocationCount) {
+      //   return NULL;
+      // }
       assert(op.result() == NULL,
              "the result should be NULL if the VM op did not succeed");
     }
-- 
2.12.3

