!266 Merge master

Merge pull request !266 from Noah/master
This commit is contained in:
openeuler-ci-bot 2021-12-22 07:49:05 +00:00 committed by Gitee
commit cc68b026e1
9 changed files with 2978 additions and 4 deletions

View File

@ -0,0 +1,52 @@
From cf0e0f39908c8de21d69139e1144c2ad131c1140 Mon Sep 17 00:00:00 2001
From: mashoubing <mashoubing1@huawei.com>
Date: Sun, 26 Sep 2021 17:30:48 +0800
Subject: [PATCH 2/4] 8233280: Remove GCLockerInvokesConcurrent relative logic
for G1
---
.../src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp | 4 ----
.../src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp | 5 ++---
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index 4f45bba52..060531901 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -2394,7 +2394,6 @@ bool G1CollectedHeap::is_user_requested_concurrent_full_gc(GCCause::Cause cause
bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) {
switch (cause) {
- case GCCause::_gc_locker: return GCLockerInvokesConcurrent;
case GCCause::_g1_humongous_allocation: return true;
case GCCause::_g1_periodic_collection: return true;
default: return is_user_requested_concurrent_full_gc(cause);
@@ -2583,9 +2582,6 @@ void G1CollectedHeap::collect(GCCause::Cause cause) {
gclog_or_tty->print_cr("Periodic GC is denied and not try !");
return;
}
- if (GC_locker::is_active_and_needs_gc()) {
- GC_locker::stall_until_clear();
- }
}
}
} else if (GC_locker::should_discard(cause, gc_count_before)) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
index d83e6cb65..3225967b3 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
@@ -354,9 +354,8 @@ private:
// It decides whether an explicit GC should start a concurrent cycle
// instead of doing a STW GC. Currently, a concurrent cycle is
// explicitly started if:
- // (a) cause == _gc_locker and +GCLockerInvokesConcurrent, or
- // (b) cause == _java_lang_system_gc and +ExplicitGCInvokesConcurrent.
- // (c) cause == _g1_humongous_allocation
+ // (a) cause == _java_lang_system_gc and +ExplicitGCInvokesConcurrent.
+ // (b) cause == _g1_humongous_allocation
bool should_do_concurrent_full_gc(GCCause::Cause cause);
// Keeps track of how many "old marking cycles" (i.e., Full GCs or
--
2.22.0

View File

@ -0,0 +1,486 @@
From 07654f80f1dc979b825c8c26c45e683547d20941 Mon Sep 17 00:00:00 2001
From: s00478819 <sunjianye@huawei.com>
Date: Mon, 25 Oct 2021 17:38:14 +0800
Subject: [PATCH 1/4] 8273111: Default timezone should return zone ID if
/etc/localtime is valid but not canonicalization on linux
---
jdk/make/lib/ServiceabilityLibraries.gmk | 1 +
.../solaris/native/java/io/canonicalize_md.c | 144 +--------------
jdk/src/solaris/native/java/io/path_util.c | 166 ++++++++++++++++++
jdk/src/solaris/native/java/io/path_util.h | 31 ++++
.../solaris/native/java/util/TimeZone_md.c | 61 +++----
5 files changed, 230 insertions(+), 173 deletions(-)
create mode 100644 jdk/src/solaris/native/java/io/path_util.c
create mode 100644 jdk/src/solaris/native/java/io/path_util.h
diff --git a/jdk/make/lib/ServiceabilityLibraries.gmk b/jdk/make/lib/ServiceabilityLibraries.gmk
index 36b6c6811..2c80ffc00 100644
--- a/jdk/make/lib/ServiceabilityLibraries.gmk
+++ b/jdk/make/lib/ServiceabilityLibraries.gmk
@@ -225,6 +225,7 @@ LIBINSTRUMENT_FILES := \
PathCharsValidator.c \
Reentrancy.c \
Utilities.c \
+ path_util.c \
canonicalize_md.c
LIBINSTRUMENT_DIR := $(JDK_OUTPUTDIR)/objs/libinstrument
diff --git a/jdk/src/solaris/native/java/io/canonicalize_md.c b/jdk/src/solaris/native/java/io/canonicalize_md.c
index cb8ce69c8..2bd1ef2cd 100644
--- a/jdk/src/solaris/native/java/io/canonicalize_md.c
+++ b/jdk/src/solaris/native/java/io/canonicalize_md.c
@@ -33,154 +33,12 @@
#include <sys/stat.h>
#include <errno.h>
#include <limits.h>
-#if !defined(_ALLBSD_SOURCE)
-#include <alloca.h>
-#endif
+#include "path_util.h"
/* Note: The comments in this file use the terminology
defined in the java.io.File class */
-
-/* Check the given name sequence to see if it can be further collapsed.
- Return zero if not, otherwise return the number of names in the sequence. */
-
-static int
-collapsible(char *names)
-{
- char *p = names;
- int dots = 0, n = 0;
-
- while (*p) {
- if ((p[0] == '.') && ((p[1] == '\0')
- || (p[1] == '/')
- || ((p[1] == '.') && ((p[2] == '\0')
- || (p[2] == '/'))))) {
- dots = 1;
- }
- n++;
- while (*p) {
- if (*p == '/') {
- p++;
- break;
- }
- p++;
- }
- }
- return (dots ? n : 0);
-}
-
-
-/* Split the names in the given name sequence,
- replacing slashes with nulls and filling in the given index array */
-
-static void
-splitNames(char *names, char **ix)
-{
- char *p = names;
- int i = 0;
-
- while (*p) {
- ix[i++] = p++;
- while (*p) {
- if (*p == '/') {
- *p++ = '\0';
- break;
- }
- p++;
- }
- }
-}
-
-
-/* Join the names in the given name sequence, ignoring names whose index
- entries have been cleared and replacing nulls with slashes as needed */
-
-static void
-joinNames(char *names, int nc, char **ix)
-{
- int i;
- char *p;
-
- for (i = 0, p = names; i < nc; i++) {
- if (!ix[i]) continue;
- if (i > 0) {
- p[-1] = '/';
- }
- if (p == ix[i]) {
- p += strlen(p) + 1;
- } else {
- char *q = ix[i];
- while ((*p++ = *q++));
- }
- }
- *p = '\0';
-}
-
-
-/* Collapse "." and ".." names in the given path wherever possible.
- A "." name may always be eliminated; a ".." name may be eliminated if it
- follows a name that is neither "." nor "..". This is a syntactic operation
- that performs no filesystem queries, so it should only be used to cleanup
- after invoking the realpath() procedure. */
-
-static void
-collapse(char *path)
-{
- char *names = (path[0] == '/') ? path + 1 : path; /* Preserve first '/' */
- int nc;
- char **ix;
- int i, j;
- char *p, *q;
-
- nc = collapsible(names);
- if (nc < 2) return; /* Nothing to do */
- ix = (char **)alloca(nc * sizeof(char *));
- splitNames(names, ix);
-
- for (i = 0; i < nc; i++) {
- int dots = 0;
-
- /* Find next occurrence of "." or ".." */
- do {
- char *p = ix[i];
- if (p[0] == '.') {
- if (p[1] == '\0') {
- dots = 1;
- break;
- }
- if ((p[1] == '.') && (p[2] == '\0')) {
- dots = 2;
- break;
- }
- }
- i++;
- } while (i < nc);
- if (i >= nc) break;
-
- /* At this point i is the index of either a "." or a "..", so take the
- appropriate action and then continue the outer loop */
- if (dots == 1) {
- /* Remove this instance of "." */
- ix[i] = 0;
- }
- else {
- /* If there is a preceding name, remove both that name and this
- instance of ".."; otherwise, leave the ".." as is */
- for (j = i - 1; j >= 0; j--) {
- if (ix[j]) break;
- }
- if (j < 0) continue;
- ix[j] = 0;
- ix[i] = 0;
- }
- /* i will be incremented at the top of the loop */
- }
-
- joinNames(names, nc, ix);
-}
-
-
/* Convert a pathname to canonical form. The input path is assumed to contain
no duplicate slashes. On Solaris we can use realpath() to do most of the
work, though once that's done we still must collapse any remaining "." and
diff --git a/jdk/src/solaris/native/java/io/path_util.c b/jdk/src/solaris/native/java/io/path_util.c
new file mode 100644
index 000000000..8a533f812
--- /dev/null
+++ b/jdk/src/solaris/native/java/io/path_util.c
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * 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
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#if !defined(_ALLBSD_SOURCE)
+#include <alloca.h>
+#endif
+#include "path_util.h"
+
+/* Check the given name sequence to see if it can be further collapsed.
+ Return zero if not, otherwise return the number of names in the sequence. */
+
+static int
+collapsible(char *names)
+{
+ char *p = names;
+ int dots = 0, n = 0;
+
+ while (*p) {
+ if ((p[0] == '.') && ((p[1] == '\0')
+ || (p[1] == '/')
+ || ((p[1] == '.') && ((p[2] == '\0')
+ || (p[2] == '/'))))) {
+ dots = 1;
+ }
+ n++;
+ while (*p) {
+ if (*p == '/') {
+ p++;
+ break;
+ }
+ p++;
+ }
+ }
+ return (dots ? n : 0);
+}
+
+/* Split the names in the given name sequence,
+ replacing slashes with nulls and filling in the given index array */
+
+static void
+splitNames(char *names, char **ix)
+{
+ char *p = names;
+ int i = 0;
+
+ while (*p) {
+ ix[i++] = p++;
+ while (*p) {
+ if (*p == '/') {
+ *p++ = '\0';
+ break;
+ }
+ p++;
+ }
+ }
+}
+
+/* Join the names in the given name sequence, ignoring names whose index
+ entries have been cleared and replacing nulls with slashes as needed */
+
+static void
+joinNames(char *names, int nc, char **ix)
+{
+ int i;
+ char *p;
+
+ for (i = 0, p = names; i < nc; i++) {
+ if (!ix[i]) continue;
+ if (i > 0) {
+ p[-1] = '/';
+ }
+ if (p == ix[i]) {
+ p += strlen(p) + 1;
+ } else {
+ char *q = ix[i];
+ while ((*p++ = *q++));
+ }
+ }
+ *p = '\0';
+}
+
+/* Collapse "." and ".." names in the given path wherever possible.
+ A "." name may always be eliminated; a ".." name may be eliminated if it
+ follows a name that is neither "." nor "..". This is a syntactic operation
+ that performs no filesystem queries, so it should only be used to cleanup
+ after invoking the realpath() procedure. */
+
+void
+collapse(char *path)
+{
+ char *names = (path[0] == '/') ? path + 1 : path; /* Preserve first '/' */
+ int nc;
+ char **ix;
+ int i, j;
+ char *p, *q;
+
+ nc = collapsible(names);
+ if (nc < 2) return; /* Nothing to do */
+ ix = (char **)alloca(nc * sizeof(char *));
+ splitNames(names, ix);
+
+ for (i = 0; i < nc; i++) {
+ int dots = 0;
+
+ /* Find next occurrence of "." or ".." */
+ do {
+ char *p = ix[i];
+ if (p[0] == '.') {
+ if (p[1] == '\0') {
+ dots = 1;
+ break;
+ }
+ if ((p[1] == '.') && (p[2] == '\0')) {
+ dots = 2;
+ break;
+ }
+ }
+ i++;
+ } while (i < nc);
+ if (i >= nc) break;
+
+ /* At this point i is the index of either a "." or a "..", so take the
+ appropriate action and then continue the outer loop */
+ if (dots == 1) {
+ /* Remove this instance of "." */
+ ix[i] = 0;
+ }
+ else {
+ /* If there is a preceding name, remove both that name and this
+ instance of ".."; otherwise, leave the ".." as is */
+ for (j = i - 1; j >= 0; j--) {
+ if (ix[j]) break;
+ }
+ if (j < 0) continue;
+ ix[j] = 0;
+ ix[i] = 0;
+ }
+ /* i will be incremented at the top of the loop */
+ }
+
+ joinNames(names, nc, ix);
+}
diff --git a/jdk/src/solaris/native/java/io/path_util.h b/jdk/src/solaris/native/java/io/path_util.h
new file mode 100644
index 000000000..7b0fd5eb1
--- /dev/null
+++ b/jdk/src/solaris/native/java/io/path_util.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * 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
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef PATH_UTIL_H
+#define PATH_UTIL_H
+
+void collapse(char *path);
+
+#endif
diff --git a/jdk/src/solaris/native/java/util/TimeZone_md.c b/jdk/src/solaris/native/java/util/TimeZone_md.c
index c183a723d..df1450e03 100644
--- a/jdk/src/solaris/native/java/util/TimeZone_md.c
+++ b/jdk/src/solaris/native/java/util/TimeZone_md.c
@@ -41,6 +41,7 @@
#include "jvm.h"
#include "TimeZone_md.h"
+#include "path_util.h"
static char *isFileIdentical(char* buf, size_t size, char *pathname);
@@ -77,6 +78,33 @@ static const char *ETC_ENVIRONMENT_FILE = "/etc/environment";
#if defined(__linux__) || defined(MACOSX) || defined(__solaris__)
+/*
+ * remove repeated path separators ('/') in the given 'path'.
+ */
+static void
+removeDuplicateSlashes(char *path)
+{
+ char *left = path;
+ char *right = path;
+ char *end = path + strlen(path);
+
+ for (; right < end; right++) {
+ // Skip sequence of multiple path-separators.
+ while (*right == '/' && *(right + 1) == '/') {
+ right++;
+ }
+
+ while (*right != '\0' && !(*right == '/' && *(right + 1) == '/')) {
+ *left++ = *right++;
+ }
+
+ if (*right == '\0') {
+ *left = '\0';
+ break;
+ }
+ }
+}
+
/*
* Returns a pointer to the zone ID portion of the given zoneinfo file
* name, or NULL if the given string doesn't contain "zoneinfo/".
@@ -319,36 +347,9 @@ getPlatformTimeZoneID()
return NULL;
}
linkbuf[len] = '\0';
-
- /* linkbuf may be a relative symlink or has more than one characters, like '.' and '/' ,
- * which will cause the function call getZoneName return to an abnormal timeZone name.
- * For example, linkbuf is "../usr/share/zoneinfo//Asia/Shanghai", then the call of
- * getZoneName(linkbuf) will get "/Asia/Shanghai", not "Asia/Shanghai".
- * So we covert it to an absolute path by adding the file's (which is define by macro
- * DEFAULT_ZONEINFO_FILE) dirname and then call glibc's realpath API to canonicalize
- * the path.
- */
- char abslinkbuf[2 * (PATH_MAX + 1)];
- if (linkbuf[0] != '/') {
- if (sprintf(abslinkbuf, "%s/%s", DEFAULT_ZONEINFO_FILE_DIRNAME, linkbuf) < 0) {
- jio_fprintf(stderr, (const char *) "failed to generate absolute path\n");
- return NULL;
- }
- } else {
- strncpy(abslinkbuf, linkbuf, len + 1);
- }
-
- /* canonicalize the path */
- char resolvedpath[PATH_MAX + 1];
- resolvedpath[PATH_MAX] = '\0';
- char *path = realpath(abslinkbuf, resolvedpath);
- if (path == NULL) {
- jio_fprintf(stderr, (const char *) "failed to get real path, symlink is %s\n",
- abslinkbuf);
- return NULL;
- }
-
- tz = getZoneName(resolvedpath);
+ removeDuplicateSlashes(linkbuf);
+ collapse(linkbuf);
+ tz = getZoneName(linkbuf);
if (tz != NULL) {
tz = strdup(tz);
return tz;
--
2.22.0

View File

@ -0,0 +1,121 @@
From d64c9b5f69fa307c1fdc44ce8e2a063e805400b8 Mon Sep 17 00:00:00 2001
From: zhangyipeng <zhangyipeng7@huawei.com>
Date: Wed, 15 Dec 2021 18:26:13 +0800
Subject: [PATCH 2/2] Delete expired certificate
---
jdk/make/data/cacerts/globalsignr2ca | 29 -------------------
jdk/make/data/cacerts/identrustdstx3 | 27 -----------------
.../security/lib/cacerts/VerifyCACerts.java | 8 ++---
3 files changed, 2 insertions(+), 62 deletions(-)
delete mode 100644 jdk/make/data/cacerts/globalsignr2ca
delete mode 100644 jdk/make/data/cacerts/identrustdstx3
diff --git a/jdk/make/data/cacerts/globalsignr2ca b/jdk/make/data/cacerts/globalsignr2ca
deleted file mode 100644
index 746d1fab9..000000000
--- a/jdk/make/data/cacerts/globalsignr2ca
+++ /dev/null
@@ -1,29 +0,0 @@
-Owner: CN=GlobalSign, O=GlobalSign, OU=GlobalSign Root CA - R2
-Issuer: CN=GlobalSign, O=GlobalSign, OU=GlobalSign Root CA - R2
-Serial number: 400000000010f8626e60d
-Valid from: Fri Dec 15 08:00:00 GMT 2006 until: Wed Dec 15 08:00:00 GMT 2021
-Signature algorithm name: SHA1withRSA
-Subject Public Key Algorithm: 2048-bit RSA key
-Version: 3
------BEGIN CERTIFICATE-----
-MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4G
-A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNp
-Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1
-MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEG
-A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI
-hvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6ErPL
-v4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8
-eoLrvozps6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklq
-tTleiDTsvHgMCJiEbKjNS7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzd
-C9XZzPnqJworc5HGnRusyMvo4KD0L5CLTfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pa
-zq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6CygPCm48CAwEAAaOBnDCB
-mTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUm+IH
-V2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5n
-bG9iYWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG
-3lm0mi3f3BmGLjANBgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4Gs
-J0/WwbgcQ3izDJr86iw8bmEbTUsp9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO
-291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu01yiPqFbQfXf5WRDLenVOavS
-ot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG79G+dwfCMNYxd
-AfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
-TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
------END CERTIFICATE-----
diff --git a/jdk/make/data/cacerts/identrustdstx3 b/jdk/make/data/cacerts/identrustdstx3
deleted file mode 100644
index 87a0d0c4f..000000000
--- a/jdk/make/data/cacerts/identrustdstx3
+++ /dev/null
@@ -1,27 +0,0 @@
-Owner: CN=DST Root CA X3, O=Digital Signature Trust Co.
-Issuer: CN=DST Root CA X3, O=Digital Signature Trust Co.
-Serial number: 44afb080d6a327ba893039862ef8406b
-Valid from: Sat Sep 30 21:12:19 GMT 2000 until: Thu Sep 30 14:01:15 GMT 2021
-Signature algorithm name: SHA1withRSA
-Subject Public Key Algorithm: 2048-bit RSA key
-Version: 3
------BEGIN CERTIFICATE-----
-MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/
-MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
-DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow
-PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD
-Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
-AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O
-rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq
-OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b
-xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw
-7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40dutolucbY38EVAjqr2m7xPi71XAicPNaD
-aeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
-HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQMA0GCSqG
-SIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69
-ikugdB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXr
-AvHRAosZy5Q6XkjEGB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZz
-R8srzJmwN0jP41ZL9c8PDHIyh8bwRLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5
-JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubSfZGL+T0yjWW06XyxV3bqxbYo
-Ob8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
------END CERTIFICATE-----
diff --git a/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java b/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java
index e4fc63ad7..f46355e8c 100644
--- a/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java
+++ b/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java
@@ -53,12 +53,12 @@ public class VerifyCACerts {
+ File.separator + "security" + File.separator + "cacerts";
// The numbers of certs now.
- private static final int COUNT = 86;
+ private static final int COUNT = 84;
// SHA-256 of cacerts, can be generated with
// shasum -a 256 cacerts | sed -e 's/../&:/g' | tr '[:lower:]' '[:upper:]' | cut -c1-95
private static final String CHECKSUM
- = "A5:00:71:02:B4:8B:AC:BE:64:34:0A:F2:DF:9D:F7:75:9D:05:84:7E:F6:EA:48:F0:64:36:29:8C:E7:A2:2D:63";
+ = "D3:05:21:64:FA:D7:CD:29:E8:CB:57:E7:47:ED:79:9B:47:D8:0E:75:2D:CA:83:BB:86:AF:D9:43:FD:3E:17:85";
// map of cert alias to SHA-256 fingerprint
@SuppressWarnings("serial")
@@ -139,8 +139,6 @@ public class VerifyCACerts {
"49:E7:A4:42:AC:F0:EA:62:87:05:00:54:B5:25:64:B6:50:E4:F4:9E:42:E3:48:D6:AA:38:E0:39:E9:57:B1:C1");
put("dtrustclass3ca2ev [jdk]",
"EE:C5:49:6B:98:8C:E9:86:25:B9:34:09:2E:EC:29:08:BE:D0:B0:F3:16:C2:D4:73:0C:84:EA:F1:F3:D3:48:81");
- put("identrustdstx3 [jdk]",
- "06:87:26:03:31:A7:24:03:D9:09:F1:05:E6:9B:CF:0D:32:E1:BD:24:93:FF:C6:D9:20:6D:11:BC:D6:77:07:39");
put("identrustpublicca [jdk]",
"30:D0:89:5A:9A:44:8A:26:20:91:63:55:22:D1:F5:20:10:B5:86:7A:CA:E1:2C:78:EF:95:8F:D4:F4:38:9F:2F");
put("identrustcommercial [jdk]",
@@ -209,8 +207,6 @@ public class VerifyCACerts {
"17:9F:BC:14:8A:3D:D0:0F:D2:4E:A1:34:58:CC:43:BF:A7:F5:9C:81:82:D7:83:A5:13:F6:EB:EC:10:0C:89:24");
put("globalsigneccrootcar4 [jdk]",
"BE:C9:49:11:C2:95:56:76:DB:6C:0A:55:09:86:D7:6E:3B:A0:05:66:7C:44:2C:97:62:B4:FB:B7:73:DE:22:8C");
- put("globalsignr2ca [jdk]",
- "CA:42:DD:41:74:5F:D0:B8:1E:B9:02:36:2C:F9:D8:BF:71:9D:A1:BD:1B:1E:FC:94:6F:5B:4C:99:F4:2C:1B:9E");
put("teliasonerarootcav1 [jdk]",
"DD:69:36:FE:21:F8:F0:77:C1:23:A1:A5:21:C1:22:24:F7:22:55:B7:3E:03:A7:26:06:93:E8:A2:4B:0F:A3:89");
put("globalsignrootcar6 [jdk]",
--
2.22.0

1520
G1-Full-GC-parallel-mark.patch Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,630 @@
From f6f0d05f65a35672f48f63d7e8f73a8c2f56d1c3 Mon Sep 17 00:00:00 2001
From: mashoubing <mashoubing1@huawei.com>
Date: Wed, 25 Aug 2021 14:22:13 +0800
Subject: [PATCH 4/4] G1Ucommit: Refactor Trigger mechanism
---
.../g1/concurrentG1RefineThread.cpp | 65 ---------------
.../g1/concurrentG1RefineThread.hpp | 1 -
.../gc_implementation/g1/concurrentMark.cpp | 2 +-
.../gc_implementation/g1/g1CollectedHeap.cpp | 51 ++++++++----
.../gc_implementation/g1/g1CollectedHeap.hpp | 5 +-
.../g1/g1CollectorPolicy.cpp | 60 --------------
.../g1/g1CollectorPolicy.hpp | 20 +----
.../gc_implementation/g1/g1UncommitThread.cpp | 82 ++++++++++++++++++-
.../gc_implementation/g1/g1UncommitThread.hpp | 2 +
.../g1/heapRegionManager.cpp | 28 ++++---
.../g1/heapRegionManager.hpp | 2 +-
.../g1/heapRegionManager.inline.hpp | 2 +-
12 files changed, 142 insertions(+), 178 deletions(-)
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp
index 98a43ba62..e4ec84895 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp
@@ -100,69 +100,6 @@ void ConcurrentG1RefineThread::sample_young_list_rs_lengths() {
}
}
-bool ConcurrentG1RefineThread::should_start_periodic_gc() {
- // If we are currently in a concurrent mark we are going to uncommit memory soon.
- if (G1CollectedHeap::heap()->concurrent_mark()->cmThread()->during_cycle()) {
- if (G1UncommitLog) {
- gclog_or_tty->print_cr("Concurrent cycle in progress. Skipping.");
- }
- return false;
- }
-
- // Check if enough time has passed since the last GC.
- uintx time_since_last_gc;
- if ((time_since_last_gc = (uintx)Universe::heap()->millis_since_last_gc()) < G1PeriodicGCInterval) {
- if (G1UncommitLog) {
- gclog_or_tty->print_cr("Last GC occurred " UINTX_FORMAT "ms before which is below threshold " UINTX_FORMAT "ms. Skipping.",
- time_since_last_gc, G1PeriodicGCInterval);
- }
- return false;
- }
-
- return true;
-}
-
-void ConcurrentG1RefineThread::check_for_periodic_gc() {
- if (!G1Uncommit) {
- return;
- }
-
- assert(G1PeriodicGCInterval > 0, "just checking");
- double recent_load = -1.0;
- G1CollectedHeap* g1h = G1CollectedHeap::heap();
- G1CollectorPolicy* g1p = g1h->g1_policy();
- if (G1PeriodicGCLoadThreshold) {
- // Sample process load and store it
- if (G1PeriodicGCProcessLoad) {
- recent_load = os::get_process_load() * 100;
- }
- if (recent_load < 0) {
- // Fallback to os load
- G1PeriodicGCProcessLoad = false;
- if (os::loadavg(&recent_load, 1) != -1) {
- static int cpu_count = os::active_processor_count();
- assert(cpu_count > 0, "just checking");
- recent_load = recent_load * 100 / cpu_count;
- }
- }
- if (recent_load >= 0) {
- g1p->add_os_load(recent_load);
- }
- }
-
- double now = os::elapsedTime();
- if (now - _last_periodic_gc_attempt_s > G1PeriodicGCInterval / 1000.0) {
- if (G1UncommitLog) {
- recent_load < 0 ? gclog_or_tty->print_cr("Checking for periodic GC.")
- : gclog_or_tty->print_cr("Checking for periodic GC. Current load %1.2f. Heap total " UINT32_FORMAT " free " UINT32_FORMAT, recent_load, g1h->_hrm.length(), g1h->_hrm.num_free_regions());
- }
- if (should_start_periodic_gc()) {
- g1p->set_periodic_gc();
- }
- _last_periodic_gc_attempt_s = now;
- }
-}
-
void ConcurrentG1RefineThread::run_young_rs_sampling() {
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
_vtime_start = os::elapsedVTime();
@@ -175,8 +112,6 @@ void ConcurrentG1RefineThread::run_young_rs_sampling() {
_vtime_accum = 0.0;
}
- check_for_periodic_gc();
-
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
if (_should_terminate) {
break;
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp
index 8fa521371..6c712fd2d 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp
@@ -71,7 +71,6 @@ class ConcurrentG1RefineThread: public ConcurrentGCThread {
void deactivate();
void check_for_periodic_gc();
- bool should_start_periodic_gc();
public:
virtual void run();
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
index 447bee183..831ec94fa 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
@@ -1354,7 +1354,7 @@ void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) {
satb_mq_set.set_active_all_threads(false, /* new active value */
true /* expected_active */);
- g1h->extract_uncommit_list();
+ g1h->shrink_heap_at_remark();
if (VerifyDuringGC) {
HandleMark hm; // handle scope
Universe::heap()->prepare_for_verify();
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index 1f1042caa..6ee33fd05 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -1565,6 +1565,19 @@ void G1CollectedHeap::do_full_collection(bool clear_all_soft_refs) {
void
G1CollectedHeap::
resize_if_necessary_after_full_collection(size_t word_size) {
+ bool should_expand;
+ size_t resize_amount = full_collection_resize_amount(should_expand);
+
+ if (resize_amount == 0) {
+ return;
+ } else if (should_expand) {
+ expand(resize_amount);
+ } else {
+ shrink(resize_amount);
+ }
+}
+
+size_t G1CollectedHeap::full_collection_resize_amount(bool& expand) {
// Include the current allocation, if any, and bytes that will be
// pre-allocated to support collections, as "used".
const size_t capacity_after_gc = capacity();
@@ -1630,8 +1643,8 @@ resize_if_necessary_after_full_collection(size_t word_size) {
ergo_format_byte_perc("min desired capacity"),
capacity_after_gc, used_after_gc,
minimum_desired_capacity, (double) MinHeapFreeRatio);
- expand(expand_bytes);
-
+ expand = true;
+ return expand_bytes;
// No expansion, now see if we want to shrink
} else if (capacity_after_gc > maximum_desired_capacity) {
// Capacity too large, compute shrinking size
@@ -1645,10 +1658,13 @@ resize_if_necessary_after_full_collection(size_t word_size) {
ergo_format_byte_perc("max desired capacity"),
capacity_after_gc, used_after_gc,
maximum_desired_capacity, (double) MaxHeapFreeRatio);
- shrink(shrink_bytes);
+ expand = false;
+ return shrink_bytes;
}
-}
+ expand = true;
+ return 0;
+}
HeapWord*
G1CollectedHeap::satisfy_failed_allocation(size_t word_size,
@@ -2185,12 +2201,6 @@ void G1CollectedHeap::stop() {
}
}
-void G1CollectedHeap::check_trigger_periodic_gc() {
- if (g1_policy()->should_trigger_periodic_gc()) {
- collect(GCCause::_g1_periodic_collection);
- }
-}
-
void G1CollectedHeap::init_periodic_gc_thread() {
if (_uncommit_thread == NULL && G1Uncommit) {
PeriodicGC::start();
@@ -2198,10 +2208,22 @@ void G1CollectedHeap::init_periodic_gc_thread() {
}
}
-void G1CollectedHeap::extract_uncommit_list() {
- if (g1_policy()->can_extract_uncommit_list()) {
- uint count = _hrm.extract_uncommit_list();
- g1_policy()->record_extract_uncommit_list(count);
+void G1CollectedHeap::shrink_heap_at_remark() {
+ if (!G1Uncommit) {
+ return;
+ }
+
+ bool should_expand;
+ size_t resize_amount = full_collection_resize_amount(should_expand);
+ uint length = _hrm.length();
+
+ if (resize_amount > 0 && !should_expand) {
+ uint num_candidate_to_remove = (uint)(resize_amount / HeapRegion::GrainBytes);
+ uint count = _hrm.extract_uncommit_list(num_candidate_to_remove);
+
+ gclog_or_tty->print(" [G1Uncommit list " UINT32_FORMAT ", remaining " UINT32_FORMAT
+ ", free list " UINT32_FORMAT "]",
+ count, length - count, _hrm.num_free_regions());
}
}
@@ -4037,7 +4059,6 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
double pause_start_sec = os::elapsedTime();
- g1_policy()->record_gc_start(pause_start_sec);
g1_policy()->phase_times()->note_gc_start(active_workers, mark_in_progress());
log_gc_header();
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
index 3225967b3..d0ec5a773 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
@@ -626,6 +626,8 @@ protected:
// and will be considered part of the used portion of the heap.
void resize_if_necessary_after_full_collection(size_t word_size);
+ size_t full_collection_resize_amount(bool& expand);
+
// Callback from VM_G1CollectForAllocation operation.
// This function does everything necessary/possible to satisfy a
// failed allocation request (including collection, expansion, etc.)
@@ -1026,9 +1028,8 @@ public:
void set_refine_cte_cl_concurrency(bool concurrent);
- void check_trigger_periodic_gc();
void init_periodic_gc_thread();
- void extract_uncommit_list();
+ void shrink_heap_at_remark();
RefToScanQueue *task_queue(int i) const;
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
index 099762f2b..05ce59987 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
@@ -89,7 +89,6 @@ G1CollectorPolicy::G1CollectorPolicy() :
_concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
_alloc_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
- _heap_size_seq(new TruncatedSeq(TruncatedSeqLength)),
_os_load_seq(new TruncatedSeq(TruncatedSeqLength)),
_gc_count_seq(new TruncatedSeq(TruncatedSeqLength)),
_prev_collection_pause_end_ms(0.0),
@@ -112,11 +111,9 @@ G1CollectorPolicy::G1CollectorPolicy() :
_pause_time_target_ms((double) MaxGCPauseMillis),
_gcs_are_young(true),
- _periodic_gc(false),
_last_uncommit_attempt_s(0.0),
_os_load(-1.0),
_uncommit_start_time(0),
- _gc_count_cancel_extract(false),
_gc_count(0),
_gc_count_minute(0),
@@ -160,7 +157,6 @@ G1CollectorPolicy::G1CollectorPolicy() :
_inc_cset_predicted_elapsed_time_ms(0.0),
_inc_cset_predicted_elapsed_time_ms_diffs(0.0),
_collection_pause_end_millis(os::javaTimeNanos() / NANOSECS_PER_MILLISEC),
- _extract_uncommit_list(0),
#ifdef _MSC_VER // the use of 'this' below gets a warning, make it go away
#pragma warning( disable:4355 ) // 'this' : used in base member initializer list
#endif // _MSC_VER
@@ -1211,8 +1207,6 @@ void G1CollectorPolicy::record_heap_size_info_at_start(bool full) {
_heap_capacity_bytes_before_gc = _g1->capacity();
_heap_used_bytes_before_gc = _g1->used();
_cur_collection_pause_used_regions_at_start = _g1->num_used_regions();
- _heap_size_seq->add(_cur_collection_pause_used_regions_at_start);
-
_eden_capacity_bytes_before_gc =
(_young_list_target_length * HeapRegion::GrainBytes) - _survivor_used_bytes_before_gc;
@@ -1255,13 +1249,6 @@ void G1CollectorPolicy::print_detailed_heap_transition(bool full) {
EXT_SIZE_PARAMS(heap_used_bytes_after_gc),
EXT_SIZE_PARAMS(heap_capacity_bytes_after_gc));
- if (_extract_uncommit_list) {
- gclog_or_tty->print(" [Uncommit list " UINT32_FORMAT ", remaining " UINT32_FORMAT ", free list " UINT32_FORMAT "]",
- _extract_uncommit_list,
- _g1->_hrm.length(),
- _g1->_hrm.num_free_regions());
- _extract_uncommit_list = 0;
- }
if (full) {
MetaspaceAux::print_metaspace_change(_metaspace_used_bytes_before_gc);
}
@@ -2175,53 +2162,6 @@ void G1CollectorPolicy::finalize_cset(double target_pause_time_ms, EvacuationInf
evacuation_info.set_collectionset_regions(cset_region_length());
}
-void G1CollectorPolicy::record_gc_start(double curr_sec) {
- if (_uncommit_start_time == 0) {
- _uncommit_start_time = curr_sec + G1UncommitDelay;
- }
- long curr = curr_sec / 60;
- if (curr > _gc_count_minute) {
- int diff = curr - _gc_count_minute;
- _gc_count_seq->add(_gc_count);
- for (int i = 1; i < diff; i++) {
- _gc_count_seq->add(0.0);
- }
- _gc_count_minute = curr;
- double gc_count_expected = get_new_prediction(_gc_count_seq);
- // Considering the test result, 15000 is an appropriate value for G1PeriodicGCInterval.
- _gc_count_cancel_extract = gc_count_expected > MIN2(4.0, 60000.0 / G1PeriodicGCInterval);
- _gc_count = 0;
- }
- _gc_count++;
-}
-
-bool G1CollectorPolicy::should_trigger_periodic_gc() {
- if (G1PeriodicGCLoadThreshold && _os_load > G1PeriodicGCLoadThreshold) {
- _periodic_gc = false;
- } else if (_periodic_gc) {
- _periodic_gc = false;
- return true;
- }
- return false;
-}
-
-bool G1CollectorPolicy::can_extract_uncommit_list() {
- double now = os::elapsedTime();
- if (G1Uncommit && now > _uncommit_start_time) {
- if (G1PeriodicGCLoadThreshold && _os_load > G1PeriodicGCLoadThreshold) {
- return false;
- }
- G1CollectedHeap* g1h = G1CollectedHeap::heap();
- if (!_gc_count_cancel_extract || now >= (g1h->millis_since_last_gc() + G1PeriodicGCInterval) / 1000.0) {
- if (now - _last_uncommit_attempt_s >= G1PeriodicGCInterval / 1000.0) {
- _last_uncommit_attempt_s = now;
- return true;
- }
- }
- }
- return false;
-}
-
void TraceGen0TimeData::record_start_collection(double time_to_stop_the_world_ms) {
if(TraceGen0Time) {
_all_stop_world_times_ms.add(time_to_stop_the_world_ms);
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
index 1a0d20d6f..af5d5d57a 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
@@ -244,7 +244,6 @@ private:
TruncatedSeq* _constant_other_time_ms_seq;
TruncatedSeq* _young_other_cost_per_region_ms_seq;
TruncatedSeq* _non_young_other_cost_per_region_ms_seq;
- TruncatedSeq* _heap_size_seq;
TruncatedSeq* _os_load_seq;
TruncatedSeq* _gc_count_seq;
@@ -268,8 +267,6 @@ private:
uint _free_regions_at_end_of_collection;
- uint _extract_uncommit_list;
-
size_t _recorded_rs_lengths;
size_t _max_rs_lengths;
double _sigma;
@@ -308,19 +305,12 @@ private:
size_t _gc_count;
long _gc_count_minute;
- bool _gc_count_cancel_extract;
- volatile bool _periodic_gc;
double _last_uncommit_attempt_s;
volatile double _os_load;
double _uncommit_start_time;
public:
// Accessors
-
- void set_periodic_gc() { _periodic_gc = true; }
- bool can_extract_uncommit_list();
- bool should_trigger_periodic_gc();
-
void set_region_eden(HeapRegion* hr, int young_index_in_cset) {
hr->set_eden();
hr->install_surv_rate_group(_short_lived_surv_rate_group);
@@ -346,16 +336,14 @@ public:
_max_rs_lengths = rs_lengths;
}
- size_t predict_heap_size_seq() {
- return (size_t) get_new_prediction(_heap_size_seq);
- }
-
void add_os_load(double load) {
_os_load_seq->add(load);
_os_load = get_new_prediction(_os_load_seq);
}
- void record_gc_start(double sec);
+ double os_load() {
+ return _os_load;
+ }
size_t predict_rs_length_diff() {
return (size_t) get_new_prediction(_rs_length_diff_seq);
@@ -739,8 +727,6 @@ public:
void record_stop_world_start();
void record_concurrent_pause();
- void record_extract_uncommit_list(uint count) { _extract_uncommit_list = count; }
-
// Record how much space we copied during a GC. This is typically
// called when a GC alloc region is being retired.
void record_bytes_copied_during_gc(size_t bytes) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1UncommitThread.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1UncommitThread.cpp
index 37bdbdb69..503218917 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1UncommitThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1UncommitThread.cpp
@@ -26,6 +26,9 @@
#include "gc_implementation/g1/g1UncommitThread.hpp"
#include "gc_implementation/g1/g1_globals.hpp"
+#include "gc_implementation/g1/g1Log.hpp"
+#include "gc_implementation/g1/g1CollectorPolicy.hpp"
+#include "gc_implementation/g1/concurrentMarkThread.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/os.hpp"
@@ -104,9 +107,12 @@ void PeriodicGC::start() {
}
void PeriodicGC::timer_thread_entry(JavaThread* thread, TRAPS) {
+ G1CollectedHeap* g1h = G1CollectedHeap::heap();
while(!_should_terminate) {
assert(!SafepointSynchronize::is_at_safepoint(), "PeriodicGC timer thread is a JavaThread");
- G1CollectedHeap::heap()->check_trigger_periodic_gc();
+ if (check_for_periodic_gc()) {
+ g1h->collect(GCCause::_g1_periodic_collection);
+ }
MutexLockerEx x(_monitor);
if (_should_terminate) {
@@ -116,6 +122,78 @@ void PeriodicGC::timer_thread_entry(JavaThread* thread, TRAPS) {
}
}
+bool PeriodicGC::check_for_periodic_gc() {
+ if (!G1Uncommit) {
+ return false;
+ }
+
+ return should_start_periodic_gc();
+}
+
+bool PeriodicGC::should_start_periodic_gc() {
+ G1CollectedHeap* g1h = G1CollectedHeap::heap();
+ G1CollectorPolicy* g1p = g1h->g1_policy();
+ // If we are currently in a concurrent mark we are going to uncommit memory soon.
+ if (g1h->concurrent_mark()->cmThread()->during_cycle()) {
+ if (G1UncommitLog && G1Log::finest()) {
+ gclog_or_tty->date_stamp(PrintGCDateStamps);
+ gclog_or_tty->stamp(PrintGCTimeStamps);
+ gclog_or_tty->print_cr("[G1Uncommit] Concurrent cycle in progress. Skipping.");
+ }
+ return false;
+ }
+
+ // Check if enough time has passed since the last GC.
+ uintx time_since_last_gc = (uintx)Universe::heap()->millis_since_last_gc();
+ if (time_since_last_gc < G1PeriodicGCInterval) {
+ if (G1UncommitLog && G1Log::finest()) {
+ gclog_or_tty->date_stamp(PrintGCDateStamps);
+ gclog_or_tty->stamp(PrintGCTimeStamps);
+ gclog_or_tty->print_cr("[G1Uncommit] Last GC occurred " UINTX_FORMAT "ms before which is below threshold"
+ UINTX_FORMAT "ms. Skipping.", time_since_last_gc, G1PeriodicGCInterval);
+ }
+ return false;
+ }
+
+ // Collect load need G1PeriodicGCInterval time after previous GC's end
+ assert(G1PeriodicGCInterval > 0, "just checking");
+ double recent_load = -1.0;
+
+ if (G1PeriodicGCLoadThreshold) {
+ // Sample process load and store it
+ if (G1PeriodicGCProcessLoad) {
+ recent_load = os::get_process_load() * 100;
+ }
+ if (recent_load < 0) {
+ // Fallback to os load
+ G1PeriodicGCProcessLoad = false;
+ if (os::loadavg(&recent_load, 1) != -1) {
+ static int cpu_count = os::active_processor_count();
+ assert(cpu_count > 0, "just checking");
+ recent_load = recent_load * 100 / cpu_count;
+ }
+ }
+ if (recent_load >= 0) {
+ g1p->add_os_load(recent_load);
+ }
+ }
+
+ if (G1UncommitLog) {
+ gclog_or_tty->date_stamp(PrintGCDateStamps);
+ gclog_or_tty->stamp(PrintGCTimeStamps);
+ recent_load < 0 ? gclog_or_tty->print_cr("[G1Uncommit] Checking for periodic GC.")
+ : gclog_or_tty->print_cr("[G1Uncommit] Checking for periodic GC. Current load %1.2f. "
+ "total regions: " UINT32_FORMAT" free regions: " UINT32_FORMAT,
+ recent_load, g1h->num_regions(), g1h->num_free_regions());
+ }
+
+ if (g1p->os_load() < G1PeriodicGCLoadThreshold || !G1PeriodicGCLoadThreshold) {
+ return true;
+ }
+ gclog_or_tty->print_cr("[G1Uncommit] Periodic GC request denied, skipping!");
+ return false;
+}
+
void PeriodicGC::stop() {
_should_terminate = true;
{
@@ -139,7 +217,7 @@ G1UncommitThread::G1UncommitThread() :
}
}
if (G1UncommitLog) {
- gclog_or_tty->print_cr("Periodic GC Thread start");
+ gclog_or_tty->print_cr("[G1Uncommit] Periodic GC Thread start");
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1UncommitThread.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1UncommitThread.hpp
index 883a9a418..6f1d5e35f 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1UncommitThread.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1UncommitThread.hpp
@@ -40,6 +40,8 @@ public:
static void start();
static void stop();
static bool has_error(TRAPS, const char* error);
+ static bool check_for_periodic_gc();
+ static bool should_start_periodic_gc();
};
class G1UncommitThread: public ConcurrentGCThread {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
index 56e2d32df..d31073f9f 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
@@ -573,21 +573,23 @@ void HeapRegionManager::free_uncommit_list_memory() {
}
}
-uint HeapRegionManager::extract_uncommit_list()
-{
+uint HeapRegionManager::extract_uncommit_list(uint num_candidate_to_remove) {
assert_at_safepoint(true /* should_be_vm_thread */);
+ double start_up_sec = os::elapsedTime();
+ if (start_up_sec < G1UncommitDelay) {
+ gclog_or_tty->date_stamp(PrintGCDateStamps);
+ gclog_or_tty->stamp(PrintGCTimeStamps);
+ gclog_or_tty->print_cr("start up seconds:%lf, less than G1UncommitDelay, will not uncommit.", start_up_sec);
+ return 0;
+ }
+
if (!_uncommit_list_filled) {
- G1CollectedHeap* g1h = G1CollectedHeap::heap();
- uint dest = ((G1CollectorPolicy*)g1h->collector_policy())->predict_heap_size_seq();
-
- if (dest < _num_committed) {
- uint num_regions_to_remove = (_num_committed - dest) * G1UncommitPercent;
- if (num_regions_to_remove >= 1 && num_regions_to_remove < _free_list.length()) {
- int count = _free_list.move_regions_to(&_uncommit_list, num_regions_to_remove);
- OrderAccess::storestore();
- _uncommit_list_filled = true;
- return count;
- }
+ uint num_regions_to_remove = num_candidate_to_remove * G1UncommitPercent;
+ if (num_regions_to_remove >= 1 && num_regions_to_remove < _free_list.length()) {
+ int count = _free_list.move_regions_to(&_uncommit_list, num_regions_to_remove);
+ OrderAccess::storestore();
+ _uncommit_list_filled = true;
+ return count;
}
}
return 0;
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp
index 25f3a223f..3950d6280 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp
@@ -175,7 +175,7 @@ public:
G1RegionToSpaceMapper* cardtable,
G1RegionToSpaceMapper* card_counts);
- uint extract_uncommit_list();
+ uint extract_uncommit_list(uint num_candidate_to_remove);
void free_uncommit_list_memory();
// Return the "dummy" region used for G1AllocRegion. This is currently a hardwired
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.inline.hpp
index 68840d61e..50d0fa832 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.inline.hpp
@@ -40,8 +40,8 @@ inline HeapRegion* HeapRegionManager::addr_to_region(HeapWord* addr) const {
}
inline HeapRegion* HeapRegionManager::at(uint index) const {
- assert(is_available(index), "pre-condition");
HeapRegion* hr = _regions.get_by_index(index);
+ assert(hr->in_uncommit_list() || is_available(index), "pre-condition");
assert(hr != NULL, "sanity");
assert(hr->hrm_index() == index, "sanity");
return hr;
--
2.22.0

View File

@ -0,0 +1,67 @@
From 309b16c487fa42fc65781da3ccf79af67f142ee9 Mon Sep 17 00:00:00 2001
From: mashoubing <mashoubing1@huawei.com>
Date: Mon, 6 Dec 2021 16:05:39 +0800
Subject: [PATCH] G1Uncommit: add G1UncommitLog limit before G1Uncommit log
message
---
.../src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp | 8 +++++---
.../share/vm/gc_implementation/g1/g1UncommitThread.cpp | 4 +++-
.../share/vm/gc_implementation/g1/heapRegionManager.cpp | 8 +++++---
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index 6ee33fd05..f7266c9c4 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -2221,9 +2221,11 @@ void G1CollectedHeap::shrink_heap_at_remark() {
uint num_candidate_to_remove = (uint)(resize_amount / HeapRegion::GrainBytes);
uint count = _hrm.extract_uncommit_list(num_candidate_to_remove);
- gclog_or_tty->print(" [G1Uncommit list " UINT32_FORMAT ", remaining " UINT32_FORMAT
- ", free list " UINT32_FORMAT "]",
- count, length - count, _hrm.num_free_regions());
+ if (G1UncommitLog) {
+ gclog_or_tty->print(" [G1Uncommit list " UINT32_FORMAT ", remaining " UINT32_FORMAT
+ ", free list " UINT32_FORMAT "]",
+ count, length - count, _hrm.num_free_regions());
+ }
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1UncommitThread.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1UncommitThread.cpp
index 503218917..280313b69 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1UncommitThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1UncommitThread.cpp
@@ -190,7 +190,9 @@ bool PeriodicGC::should_start_periodic_gc() {
if (g1p->os_load() < G1PeriodicGCLoadThreshold || !G1PeriodicGCLoadThreshold) {
return true;
}
- gclog_or_tty->print_cr("[G1Uncommit] Periodic GC request denied, skipping!");
+ if (G1UncommitLog) {
+ gclog_or_tty->print_cr("[G1Uncommit] Periodic GC request denied, skipping!");
+ }
return false;
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
index d31073f9f..83513b3b8 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
@@ -577,9 +577,11 @@ uint HeapRegionManager::extract_uncommit_list(uint num_candidate_to_remove) {
assert_at_safepoint(true /* should_be_vm_thread */);
double start_up_sec = os::elapsedTime();
if (start_up_sec < G1UncommitDelay) {
- gclog_or_tty->date_stamp(PrintGCDateStamps);
- gclog_or_tty->stamp(PrintGCTimeStamps);
- gclog_or_tty->print_cr("start up seconds:%lf, less than G1UncommitDelay, will not uncommit.", start_up_sec);
+ if (G1UncommitLog) {
+ gclog_or_tty->date_stamp(PrintGCDateStamps);
+ gclog_or_tty->stamp(PrintGCTimeStamps);
+ gclog_or_tty->print_cr("start up seconds:%lf, less than G1UncommitDelay, will not uncommit.", start_up_sec);
+ }
return 0;
}
--
2.22.0

View File

@ -0,0 +1,27 @@
From: zhangyipeng <zhangyipeng7@huawei.com>
Date: Thu, 4 Mar 2021 11:10:07 +0800
Subject: add wrap_memcpy to libsaproc
---
hotspot/make/linux/makefiles/saproc.make | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hotspot/make/linux/makefiles/saproc.make b/hotspot/make/linux/makefiles/saproc.make
index dfeb254da..258585366 100644
--- a/hotspot/make/linux/makefiles/saproc.make
+++ b/hotspot/make/linux/makefiles/saproc.make
@@ -46,6 +46,11 @@ SASRCFILES = $(SASRCDIR)/salibelf.c \
$(SASRCDIR)/LinuxDebuggerLocal.c \
$(AGENT_DIR)/src/share/native/sadis.c
+# wrap memcpy
+ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
+ SASRCFILES += $(HOTSPOT_TOPDIR)/src/os_cpu/linux_x86/vm/memcpy.cpp
+endif
+
-include $(HS_ALT_MAKE)/linux/makefiles/saproc.make
SAMAPFILE = $(SASRCDIR)/mapfile
--
2.19.0

View File

@ -0,0 +1,26 @@
From: zhangyipeng <zhangyipeng7@huawei.com>
Date: Thu, 4 Mar 2021 09:38:42 +0800
---
jdk/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/jdk/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c b/jdk/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c
index 9b3ff8194..bb9be2ccb 100644
--- a/jdk/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c
+++ b/jdk/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c
@@ -63,6 +63,11 @@
#include "sun_nio_ch_FileDispatcherImpl.h"
#include "java_lang_Long.h"
+#if defined(aarch64)
+ __asm__(".symver fcntl64,fcntl@GLIBC_2.17");
+#elif defined(amd64)
+ __asm__(".symver fcntl64,fcntl@GLIBC_2.2.5");
+#endif
static int preCloseFD = -1; /* File descriptor to which we dup other fd's
before closing them for real */
--
2.19.0

View File

@ -916,7 +916,7 @@ Provides: java-%{javaver}-%{origin}-accessibility%{?1} = %{epoch}:%{version}-%{r
Name: java-%{javaver}-%{origin}
Version: %{javaver}.%{updatever}.%{buildver}
Release: 1
Release: 10
# 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
@ -1115,9 +1115,19 @@ Patch217: 8202142-jfr-event-io-TestInstrumentation-is-unstable.patch
Patch218: 8143251-Thread-suspend-on-VM_G1IncCollectionPause-do.patch
Patch219: G1Uncommit-Introduce-G1PeriodGCNotRetry-control-whet.patch
Patch220: JDK-debug-version-crash-when-using-AppCDS.patch
Patch221: 8183543-Aarch64-C2-compilation-often-fails-with-fail--last.patch
# 8u312
Patch221: 8183543-Aarch64-C2-compilation-often-fails-with-fail--last.patch
Patch222: 8273111-Default-timezone-should-return-zone-ID-if-locatiome-is-valid-but-not-canonicalization-on-linux.patch
Patch223: 8233280-Remove-GCLockerInvokesConcurrent-relative-logic-for-G1.patch
Patch224: G1Ucommit-Refactor-Trigger-mechanism.patch
Patch225: G1-Full-GC-parallel-mark.patch
Patch226: G1Uncommit-add-G1UncommitLog-limit-before-G1Uncommit.patch
Patch227: Delete-expired-certificate-globalsignr2ca.patch
Patch228: add-wrap_memcpy-to-libsaproc.patch
Patch229: downgrade-the-symver-of-fcntl64.patch
# 8u322
#############################################
#
@ -1582,6 +1592,14 @@ pushd %{top_level_dir_name}
%patch219 -p1
%patch220 -p1
%patch221 -p1
%patch222 -p1
%patch223 -p1
%patch224 -p1
%patch225 -p1
%patch226 -p1
%patch227 -p1
%patch228 -p1
%patch229 -p1
popd
# System library fixes
@ -1655,10 +1673,10 @@ export ARCH_DATA_MODEL=64
# We use ourcppflags because the OpenJDK build seems to
# pass EXTRA_CFLAGS to the HotSpot C++ compiler...
EXTRA_CFLAGS="%ourcppflags -Wno-error -fcommon -fsigned-char -fstack-protector-all"
EXTRA_CFLAGS="%ourcppflags -Wno-error -fcommon -fsigned-char"
EXTRA_CPP_FLAGS="%ourcppflags -Wno-error"
EXTRA_ASFLAGS="${EXTRA_CFLAGS} -Wa,--generate-missing-build-notes=yes -fstack-protector-all"
EXTRA_ASFLAGS="${EXTRA_CFLAGS} -Wa,--generate-missing-build-notes=yes"
export EXTRA_CFLAGS EXTRA_ASFLAGS
for suffix in %{build_loop} ; do
@ -2199,6 +2217,33 @@ require "copy_jdk_configs.lua"
%endif
%changelog
* Tue Dec 21 2021 kuenking111 <wangkun49@huawei.com> - 1:1.8.0.312-b07.10
- delete stack protection
* Mon Dec 20 2021 kuenking111 <wangkun49@huawei.com> - 1:1.8.0.312-b07.9
- add downgrade-the-symver-of-fcntl64.patch
* Mon Dec 20 2021 kuenking111 <wangkun49@huawei.com> - 1:1.8.0.312-b07.8
- add wrap_memcpy to libsaproc
* Thu Dec 16 2021 kuenking111 <wangkun49@huawei.com> - 1:1.8.0.312-b07.7
- add Delete-expired-certificate-globalsignr2ca.patch
* Fri Dec 10 2021 kuenking111 <wangkun49@huawei.com> - 1:1.8.0.312-b07.6
- add G1Uncommit-add-G1UncommitLog-limit-before-G1Uncommit.patch
* Fri Dec 10 2021 kuenking111 <wangkun49@huawei.com> - 1:1.8.0.312-b07.5
- add G1-Full-GC-parallel-mark.patch
* Fri Dec 10 2021 kuenking111 <wangkun49@huawei.com> - 1:1.8.0.312-b07.4
- add G1Ucommit-Refactor-Trigger-mechanism.patch
* Fri Dec 10 2021 kuenking111 <wangkun49@huawei.com> - 1:1.8.0.312-b07.3
- add 8233280-Remove-GCLockerInvokesConcurrent-relative-logic-for-G1.patch
* Fri Dec 10 2021 kuenking111 <wangkun49@huawei.com> - 1:1.8.0.312-b07.2
- add 8273111-Default-timezone-should-return-zone-ID-if-locatiome-is-valid-but-not-canonicalization-on-linux.patch
* Tue Nov 23 2021 lijingwei <lijingwei@uniontech.com> - 1:1.8.0.312-b07.1
- correct spec file release number typo