diff --git a/PS-introduce-UsePSRelaxedForwardee-to-enable-using-r.patch b/PS-introduce-UsePSRelaxedForwardee-to-enable-using-r.patch new file mode 100755 index 0000000000000000000000000000000000000000..e510108be4557831636286a330f9a3735368be9f --- /dev/null +++ b/PS-introduce-UsePSRelaxedForwardee-to-enable-using-r.patch @@ -0,0 +1,49 @@ +diff --git a/src/hotspot/share/gc/parallel/parallel_globals.hpp b/src/hotspot/share/gc/parallel/parallel_globals.hpp +index 5461bf04f..75ee84d4f 100644 +--- a/src/hotspot/share/gc/parallel/parallel_globals.hpp ++++ b/src/hotspot/share/gc/parallel/parallel_globals.hpp +@@ -78,6 +78,10 @@ + "Delay in scheduling GC workers (in milliseconds)") \ + \ + product(bool, PSChunkLargeArrays, true, \ +- "Process large arrays in chunks") ++ "Process large arrays in chunks") \ ++ \ ++ experimental(bool, UsePSRelaxedForwardee, false, \ ++ "Use the UsePSRelaxedForwardee to enable ps use relaxed" \ ++ "during young gc copying object") + + #endif // SHARE_GC_PARALLEL_PARALLEL_GLOBALS_HPP +diff --git a/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp b/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp +index cc5a4aa98..9bf45f82b 100644 +--- a/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp ++++ b/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp +@@ -218,8 +218,15 @@ inline oop PSPromotionManager::copy_to_survivor_space(oop o) { + Copy::aligned_disjoint_words((HeapWord*)o, (HeapWord*)new_obj, new_obj_size); + + // Now we have to CAS in the header. +- // Make copy visible to threads reading the forwardee. +- if (o->cas_forward_to(new_obj, test_mark, o->klass()->oop_is_gc_leaf()? memory_order_relaxed : memory_order_release)) { ++ // When use relaxed CAS, cann't gurantee new obj visible for other threads accessing forwardee. ++ // As oop_is_gc_leaf is verified for long time without problems, for gc leaf's benefit, we add ++ // UsePSRelaxedForwardee to enable using relaxed CAS rather than delete oop_is_gc_leaf condition directly. ++#ifdef PRODUCT ++ if (o->cas_forward_to(new_obj, test_mark, (UsePSRelaxedForwardee || o->klass()->oop_is_gc_leaf()) ? ++ memory_order_relaxed : memory_order_release)) { ++#else ++ if (o->cas_forward_to(new_obj, test_mark, memory_order_release)) { ++#endif + // We won any races, we "own" this object. + assert(new_obj == o->forwardee(), "Sanity"); + +@@ -275,6 +282,10 @@ inline oop PSPromotionManager::copy_to_survivor_space(oop o) { + + // This code must come after the CAS test, or it will print incorrect + // information. ++ // When UsePSRelaxedForwardee is true or object o is gc leaf, CAS failed threads can't access forwardee's content, ++ // as relaxed CAS cann't gurantee new obj's content visible for these CAS failed threads.The below log output is ++ // dangerous.So we just support UsePSRelaxedForwardee and gc leaf in product. ++ // Everywhere access forwardee's content must be careful. + log_develop_trace(gc, scavenge)("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", + should_scavenge(&new_obj) ? "copying" : "tenuring", + new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size()); diff --git a/openjdk-11.spec b/openjdk-11.spec index 6f0379f15c86eb0777dae4de3975e448f50c12bb..6397af6fa76c9707f5619b950a852a29d25debe0 100644 --- a/openjdk-11.spec +++ b/openjdk-11.spec @@ -740,7 +740,7 @@ Provides: java-src%{?1} = %{epoch}:%{version}-%{release} Name: java-%{javaver}-%{origin} Version: %{newjavaver}.%{buildver} -Release: 2 +Release: 3 # java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons # and this change was brought into RHEL-4. java-1.5.0-ibm packages # also included the epoch in their virtual provides. This created a @@ -862,6 +862,7 @@ Patch78: create-jfr-dump-file-with-pid-or-timestamp-if-specif.patch Patch79: enhance-the-TimeZone-s-path-solution-on-Euler.patch Patch80: Add-KAE-implementation.patch Patch81: 8268427-Improve-AlgorithmConstraints-checkAlgorithm-.patch +Patch82: PS-introduce-UsePSRelaxedForwardee-to-enable-using-r.patch BuildRequires: autoconf BuildRequires: alsa-lib-devel @@ -1143,6 +1144,7 @@ pushd %{top_level_dir_name} %patch79 -p1 %patch80 -p1 %patch81 -p1 +%patch82 -p1 popd # openjdk # %patch1000 @@ -1645,6 +1647,9 @@ require "copy_jdk_configs.lua" %changelog +* Sat Sep 18 2021 kuenking111 - 1:11.0.12.7-3 +- add PS-introduce-UsePSRelaxedForwardee-to-enable-using-r.patch + * Fri Sep 17 2021 kuenking111 - 1:11.0.12.7-2 - add Update-algorithm-annotations-for-fill_words.patch - add 8257145-Performance-regression-with-XX-ResizePLAB-af.patch