Projects
home:dingli:branches:openEuler:24.09-openjdk
openjdk-11
_service:tar_scm:change-ActivePrcoessorCount-on...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:change-ActivePrcoessorCount-only-for-HBase.patch of Package openjdk-11
diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp index faf109ab1..ab83d2a6b 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp @@ -121,7 +121,8 @@ public: static int get_initial_sve_vector_length() { return _initial_sve_vector_length; }; static bool is_hisi_enabled() { - if (_cpu == CPU_HISILICON && (_model == 0xd01 || _model == 0xd02 || _model == 0xd03)) { + if (_cpu == CPU_HISILICON && (_model == 0xd01 || _model == 0xd02 || _model == 0xd03 || + _model == 0xd22 || _model == 0xd45)) { return true; } return false; diff --git a/make/hotspot/symbols/symbols-shared b/make/hotspot/symbols/symbols-shared index 5d26d1028..d955c25f2 100644 --- a/make/hotspot/symbols/symbols-shared +++ b/make/hotspot/symbols/symbols-shared @@ -28,6 +28,7 @@ jio_snprintf jio_vfprintf jio_vsnprintf JNI_CreateJavaVM +JNI_SetCParam JNI_GetCreatedJavaVMs JNI_GetDefaultJavaVMInitArgs JVM_FindClassFromBootLoader diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp index 9c2bdbbad..552267b0f 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp @@ -413,3 +413,28 @@ void VM_Version::initialize() { UNSUPPORTED_OPTION(CriticalJNINatives); } + +int VM_Version::get_cpu_model() { + int cpu_lines = 0; + if (FILE *f = fopen("/proc/cpuinfo", "r")) { + char buf[128], *p; + while (fgets(buf, sizeof (buf), f) != NULL) { + if ((p = strchr(buf, ':')) != NULL) { + long v = strtol(p+1, NULL, 0); + if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) { + _cpu = v; + cpu_lines++; + } else if (strncmp(buf, "CPU variant", sizeof "CPU variant" - 1) == 0) { + _variant = v; + } else if (strncmp(buf, "CPU part", sizeof "CPU part" - 1) == 0) { + if (_model != v) _model2 = _model; + _model = v; + } else if (strncmp(buf, "CPU revision", sizeof "CPU revision" - 1) == 0) { + _revision = v; + } + } + } + fclose(f); + } + return cpu_lines; +} \ No newline at end of file diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp index f03da8710..faf109ab1 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp @@ -112,6 +112,7 @@ public: CPU_DMB_ATOMICS = (1 << 31), }; + static int get_cpu_model(); static int cpu_family() { return _cpu; } static int cpu_model() { return _model; } static int cpu_model2() { return _model2; } diff --git a/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.cpp b/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.cpp index 9084daeaa..0d7e03cd8 100644 --- a/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.cpp +++ b/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.cpp @@ -46,6 +46,35 @@ bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, return pd_get_top_frame(fr_addr, ucontext, isInJava); } +inline unsigned int stringHash(const char* str) { + unsigned int seed = 13; + unsigned int hash = 0; + while(*str) { + hash = hash * seed + (*str++); + } + + return (hash & 0x7fffffff); +} + +void JavaThread::os_linux_aarch64_options(int apc, char **name) { + if (name == NULL) { + return; + } + VM_Version::get_cpu_model(); + if (VM_Version::is_hisi_enabled()) { + int i = 0; + int step = 0; + while (name[i] != NULL) { + if (stringHash(name[i]) == 1396789436) { + if (FLAG_IS_DEFAULT(ActiveProcessorCount) && (UseG1GC || UseParallelGC || UseZGC) && apc > 8) + FLAG_SET_DEFAULT(ActiveProcessorCount, 8); + break; + } + i++; + } + } +} + bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) { assert(this->is_Java_thread(), "must be JavaThread"); JavaThread* jt = (JavaThread *)this; diff --git a/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.hpp b/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.hpp index 985b664aa..521ac0dcc 100644 --- a/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.hpp +++ b/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.hpp @@ -55,6 +55,8 @@ bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext, bool isInJava); + static void os_linux_aarch64_options(int apc, char **name); + bool pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava); private: bool pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava); diff --git a/src/hotspot/share/prims/jni.cpp b/src/hotspot/share/prims/jni.cpp index 289283dca..0b2138d98 100644 --- a/src/hotspot/share/prims/jni.cpp +++ b/src/hotspot/share/prims/jni.cpp @@ -3951,6 +3951,11 @@ _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_GetDefaultJavaVMInitArgs(void *args_) { DT_RETURN_MARK_DECL(CreateJavaVM, jint , HOTSPOT_JNI_CREATEJAVAVM_RETURN(_ret_ref)); +const char** argv_for_execvp; +_JNI_IMPORT_OR_EXPORT_ void JNICALL JNI_SetCParam(char** raw_argv) { + argv_for_execvp = (const char**)raw_argv; +} + static jint JNI_CreateJavaVM_inner(JavaVM **vm, void **penv, void *args) { HOTSPOT_JNI_CREATEJAVAVM_ENTRY((void **) vm, penv, args); diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index 1c540bb62..214bb21f9 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -447,6 +447,11 @@ static void signal_thread_entry(JavaThread* thread, TRAPS) { } void os::init_before_ergo() { +#ifdef AARCH64 + // global variables + extern char** argv_for_execvp; + JavaThread::os_linux_aarch64_options(active_processor_count(), argv_for_execvp); +#endif initialize_initial_active_processor_count(); // We need to initialize large page support here because ergonomics takes some // decisions depending on large page support and the calculated large page size. diff --git a/src/java.base/share/native/include/jni.h b/src/java.base/share/native/include/jni.h index e15503f4d..4aaa75685 100644 --- a/src/java.base/share/native/include/jni.h +++ b/src/java.base/share/native/include/jni.h @@ -1948,6 +1948,9 @@ JNI_GetDefaultJavaVMInitArgs(void *args); _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args); +_JNI_IMPORT_OR_EXPORT_ void JNICALL +JNI_SetCParam(char** raw_argv); + _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *); diff --git a/src/java.base/share/native/libjli/java.c b/src/java.base/share/native/libjli/java.c index a38ddae63..120d8f33b 100644 --- a/src/java.base/share/native/libjli/java.c +++ b/src/java.base/share/native/libjli/java.c @@ -284,6 +284,7 @@ JLI_Launch(int argc, char ** argv, /* main argc, argv */ ifn.CreateJavaVM = 0; ifn.GetDefaultJavaVMInitArgs = 0; + ifn.raw_argv = argv; if (JLI_IsTraceLauncher()) { start = CounterGet(); @@ -1524,6 +1525,7 @@ InitializeJVM(JavaVM **pvm, JNIEnv **penv, InvocationFunctions *ifn) i, args.options[i].optionString); } + ifn->SetCParam(ifn->raw_argv); r = ifn->CreateJavaVM(pvm, (void **)penv, &args); JLI_MemFree(options); return r == JNI_OK; diff --git a/src/java.base/share/native/libjli/java.h b/src/java.base/share/native/libjli/java.h index 45acece27..43ca5cf39 100644 --- a/src/java.base/share/native/libjli/java.h +++ b/src/java.base/share/native/libjli/java.h @@ -77,13 +77,16 @@ * Pointers to the needed JNI invocation API, initialized by LoadJavaVM. */ typedef jint (JNICALL *CreateJavaVM_t)(JavaVM **pvm, void **env, void *args); +typedef void (JNICALL *SetCParam_t)(char** raw_argv); typedef jint (JNICALL *GetDefaultJavaVMInitArgs_t)(void *args); typedef jint (JNICALL *GetCreatedJavaVMs_t)(JavaVM **vmBuf, jsize bufLen, jsize *nVMs); typedef struct { CreateJavaVM_t CreateJavaVM; + SetCParam_t SetCParam; GetDefaultJavaVMInitArgs_t GetDefaultJavaVMInitArgs; GetCreatedJavaVMs_t GetCreatedJavaVMs; + char** raw_argv; } InvocationFunctions; JNIEXPORT int JNICALL diff --git a/src/java.base/unix/native/libjli/java_md_solinux.c b/src/java.base/unix/native/libjli/java_md_solinux.c index 160f91975..7526c0d9f 100644 --- a/src/java.base/unix/native/libjli/java_md_solinux.c +++ b/src/java.base/unix/native/libjli/java_md_solinux.c @@ -615,6 +615,13 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn) return JNI_FALSE; } + ifn->SetCParam = (SetCParam_t) + dlsym(libjvm, "JNI_SetCParam"); + if (ifn->SetCParam == NULL) { + JLI_ReportErrorMessage(DLL_ERROR2, jvmpath, dlerror()); + return JNI_FALSE; + } + ifn->GetDefaultJavaVMInitArgs = (GetDefaultJavaVMInitArgs_t) dlsym(libjvm, "JNI_GetDefaultJavaVMInitArgs"); if (ifn->GetDefaultJavaVMInitArgs == NULL) { -- 2.21.0.windows.1
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2