hotspot/src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File jdk10-hs Sdiff hotspot/src/share/vm/runtime

hotspot/src/share/vm/runtime/arguments.cpp

Print this page




 362 // the command-line as usual, but will issue a warning.
 363 // When the JDK version reaches 'obsolete_in' limit, the JVM will continue accepting this flag on
 364 // the command-line, while issuing a warning and ignoring the flag value.
 365 // Once the JDK version reaches 'expired_in' limit, the JVM will flatly refuse to admit the
 366 // existence of the flag.
 367 //
 368 // MANUAL CLEANUP ON JDK VERSION UPDATES:
 369 // This table ensures that the handling of options will update automatically when the JDK
 370 // version is incremented, but the source code needs to be cleanup up manually:
 371 // - As "deprecated" options age into "obsolete" or "expired" options, the associated "globals"
 372 //   variable should be removed, as well as users of the variable.
 373 // - As "deprecated" options age into "obsolete" options, move the entry into the
 374 //   "Obsolete Flags" section of the table.
 375 // - All expired options should be removed from the table.
 376 static SpecialFlag const special_jvm_flags[] = {
 377   // -------------- Deprecated Flags --------------
 378   // --- Non-alias flags - sorted by obsolete_in then expired_in:
 379   { "MaxGCMinorPauseMillis",        JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
 380   { "UseConcMarkSweepGC",           JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
 381   { "MonitorInUseLists",            JDK_Version::jdk(10),JDK_Version::undefined(), JDK_Version::undefined() },



 382 
 383   // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
 384   { "DefaultMaxRAMFraction",        JDK_Version::jdk(8),  JDK_Version::undefined(), JDK_Version::undefined() },
 385   { "CreateMinidumpOnCrash",        JDK_Version::jdk(9),  JDK_Version::undefined(), JDK_Version::undefined() },
 386   { "MustCallLoadClassInternal",    JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
 387   { "UnsyncloadClass",              JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
 388 
 389   // -------------- Obsolete Flags - sorted by expired_in --------------
 390   { "ConvertSleepToYield",           JDK_Version::jdk(9),      JDK_Version::jdk(10), JDK_Version::jdk(11) },
 391   { "ConvertYieldToSleep",           JDK_Version::jdk(9),      JDK_Version::jdk(10), JDK_Version::jdk(11) },
 392   { "MinSleepInterval",              JDK_Version::jdk(9),      JDK_Version::jdk(10), JDK_Version::jdk(11) },
 393   { "PermSize",                      JDK_Version::undefined(), JDK_Version::jdk(8),  JDK_Version::undefined() },
 394   { "MaxPermSize",                   JDK_Version::undefined(), JDK_Version::jdk(8),  JDK_Version::undefined() },
 395 
 396 #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
 397   { "dep > obs",                    JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },
 398   { "dep > exp ",                   JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(8) },
 399   { "obs > exp ",                   JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(8) },
 400   { "not deprecated or obsolete",   JDK_Version::undefined(), JDK_Version::undefined(), JDK_Version::jdk(9) },
 401   { "dup option",                   JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },


2052     if (fp != NULL) {
2053       julong cgroup_max = 0;
2054       int ret = fscanf(fp, JULONG_FORMAT, &cgroup_max);
2055       if (ret == 1 && cgroup_max > 0) {
2056         // If unlimited, cgroup_max will be a very large, but unspecified
2057         // value, so use initial phys_mem as a limit
2058         log_info(gc, heap)("Setting phys_mem to the min of cgroup limit ("
2059                            JULONG_FORMAT "MB) and initial phys_mem ("
2060                            JULONG_FORMAT "MB)", cgroup_max/M, phys_mem/M);
2061         phys_mem = MIN2(cgroup_max, phys_mem);
2062       } else {
2063         warning("Unable to read/parse cgroup memory limit from %s: %s",
2064                 lim_file, errno != 0 ? strerror(errno) : "unknown error");
2065       }
2066       fclose(fp);
2067     } else {
2068       warning("Unable to open cgroup memory limit file %s (%s)", lim_file, strerror(errno));
2069     }
2070   }
2071 













2072   // If the maximum heap size has not been set with -Xmx,
2073   // then set it as fraction of the size of physical memory,
2074   // respecting the maximum and minimum sizes of the heap.
2075   if (FLAG_IS_DEFAULT(MaxHeapSize)) {
2076     julong reasonable_max = phys_mem / MaxRAMFraction;
2077 
2078     if (phys_mem <= MaxHeapSize * MinRAMFraction) {
2079       // Small physical memory, so use a minimum fraction of it for the heap
2080       reasonable_max = phys_mem / MinRAMFraction;
2081     } else {
2082       // Not-small physical memory, so require a heap at least
2083       // as large as MaxHeapSize
2084       reasonable_max = MAX2(reasonable_max, (julong)MaxHeapSize);
2085     }

2086     if (!FLAG_IS_DEFAULT(ErgoHeapSizeLimit) && ErgoHeapSizeLimit != 0) {
2087       // Limit the heap size to ErgoHeapSizeLimit
2088       reasonable_max = MIN2(reasonable_max, (julong)ErgoHeapSizeLimit);
2089     }
2090     if (UseCompressedOops) {
2091       // Limit the heap size to the maximum possible when using compressed oops
2092       julong max_coop_heap = (julong)max_heap_for_compressed_oops();
2093 
2094       // HeapBaseMinAddress can be greater than default but not less than.
2095       if (!FLAG_IS_DEFAULT(HeapBaseMinAddress)) {
2096         if (HeapBaseMinAddress < DefaultHeapBaseMinAddress) {
2097           // matches compressed oops printing flags
2098           log_debug(gc, heap, coops)("HeapBaseMinAddress must be at least " SIZE_FORMAT
2099                                      " (" SIZE_FORMAT "G) which is greater than value given " SIZE_FORMAT,
2100                                      DefaultHeapBaseMinAddress,
2101                                      DefaultHeapBaseMinAddress/G,
2102                                      HeapBaseMinAddress);
2103           FLAG_SET_ERGO(size_t, HeapBaseMinAddress, DefaultHeapBaseMinAddress);
2104         }
2105       }


2118       // so be sure that the maximum size is consistent.  Done
2119       // after call to limit_by_allocatable_memory because that
2120       // method might reduce the allocation size.
2121       reasonable_max = MAX2(reasonable_max, (julong)InitialHeapSize);
2122     }
2123 
2124     log_trace(gc, heap)("  Maximum heap size " SIZE_FORMAT, (size_t) reasonable_max);
2125     FLAG_SET_ERGO(size_t, MaxHeapSize, (size_t)reasonable_max);
2126   }
2127 
2128   // If the minimum or initial heap_size have not been set or requested to be set
2129   // ergonomically, set them accordingly.
2130   if (InitialHeapSize == 0 || min_heap_size() == 0) {
2131     julong reasonable_minimum = (julong)(OldSize + NewSize);
2132 
2133     reasonable_minimum = MIN2(reasonable_minimum, (julong)MaxHeapSize);
2134 
2135     reasonable_minimum = limit_by_allocatable_memory(reasonable_minimum);
2136 
2137     if (InitialHeapSize == 0) {
2138       julong reasonable_initial = phys_mem / InitialRAMFraction;
2139 
2140       reasonable_initial = MAX3(reasonable_initial, reasonable_minimum, (julong)min_heap_size());
2141       reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize);
2142 
2143       reasonable_initial = limit_by_allocatable_memory(reasonable_initial);
2144 
2145       log_trace(gc, heap)("  Initial heap size " SIZE_FORMAT, (size_t)reasonable_initial);
2146       FLAG_SET_ERGO(size_t, InitialHeapSize, (size_t)reasonable_initial);
2147     }
2148     // If the minimum heap size has not been set (via -Xms),
2149     // synchronize with InitialHeapSize to avoid errors with the default value.
2150     if (min_heap_size() == 0) {
2151       set_min_heap_size(MIN2((size_t)reasonable_minimum, InitialHeapSize));
2152       log_trace(gc, heap)("  Minimum heap size " SIZE_FORMAT, min_heap_size());
2153     }
2154   }
2155 }
2156 
2157 // This option inspects the machine and attempts to set various
2158 // parameters to be optimal for long-running, memory allocation




 362 // the command-line as usual, but will issue a warning.
 363 // When the JDK version reaches 'obsolete_in' limit, the JVM will continue accepting this flag on
 364 // the command-line, while issuing a warning and ignoring the flag value.
 365 // Once the JDK version reaches 'expired_in' limit, the JVM will flatly refuse to admit the
 366 // existence of the flag.
 367 //
 368 // MANUAL CLEANUP ON JDK VERSION UPDATES:
 369 // This table ensures that the handling of options will update automatically when the JDK
 370 // version is incremented, but the source code needs to be cleanup up manually:
 371 // - As "deprecated" options age into "obsolete" or "expired" options, the associated "globals"
 372 //   variable should be removed, as well as users of the variable.
 373 // - As "deprecated" options age into "obsolete" options, move the entry into the
 374 //   "Obsolete Flags" section of the table.
 375 // - All expired options should be removed from the table.
 376 static SpecialFlag const special_jvm_flags[] = {
 377   // -------------- Deprecated Flags --------------
 378   // --- Non-alias flags - sorted by obsolete_in then expired_in:
 379   { "MaxGCMinorPauseMillis",        JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
 380   { "UseConcMarkSweepGC",           JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
 381   { "MonitorInUseLists",            JDK_Version::jdk(10),JDK_Version::undefined(), JDK_Version::undefined() },
 382   { "MaxRAMFraction",               JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
 383   { "MinRAMFraction",               JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
 384   { "InitialRAMFraction",           JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
 385 
 386   // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
 387   { "DefaultMaxRAMFraction",        JDK_Version::jdk(8),  JDK_Version::undefined(), JDK_Version::undefined() },
 388   { "CreateMinidumpOnCrash",        JDK_Version::jdk(9),  JDK_Version::undefined(), JDK_Version::undefined() },
 389   { "MustCallLoadClassInternal",    JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
 390   { "UnsyncloadClass",              JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
 391 
 392   // -------------- Obsolete Flags - sorted by expired_in --------------
 393   { "ConvertSleepToYield",           JDK_Version::jdk(9),      JDK_Version::jdk(10), JDK_Version::jdk(11) },
 394   { "ConvertYieldToSleep",           JDK_Version::jdk(9),      JDK_Version::jdk(10), JDK_Version::jdk(11) },
 395   { "MinSleepInterval",              JDK_Version::jdk(9),      JDK_Version::jdk(10), JDK_Version::jdk(11) },
 396   { "PermSize",                      JDK_Version::undefined(), JDK_Version::jdk(8),  JDK_Version::undefined() },
 397   { "MaxPermSize",                   JDK_Version::undefined(), JDK_Version::jdk(8),  JDK_Version::undefined() },
 398 
 399 #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
 400   { "dep > obs",                    JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },
 401   { "dep > exp ",                   JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(8) },
 402   { "obs > exp ",                   JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(8) },
 403   { "not deprecated or obsolete",   JDK_Version::undefined(), JDK_Version::undefined(), JDK_Version::jdk(9) },
 404   { "dup option",                   JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },


2055     if (fp != NULL) {
2056       julong cgroup_max = 0;
2057       int ret = fscanf(fp, JULONG_FORMAT, &cgroup_max);
2058       if (ret == 1 && cgroup_max > 0) {
2059         // If unlimited, cgroup_max will be a very large, but unspecified
2060         // value, so use initial phys_mem as a limit
2061         log_info(gc, heap)("Setting phys_mem to the min of cgroup limit ("
2062                            JULONG_FORMAT "MB) and initial phys_mem ("
2063                            JULONG_FORMAT "MB)", cgroup_max/M, phys_mem/M);
2064         phys_mem = MIN2(cgroup_max, phys_mem);
2065       } else {
2066         warning("Unable to read/parse cgroup memory limit from %s: %s",
2067                 lim_file, errno != 0 ? strerror(errno) : "unknown error");
2068       }
2069       fclose(fp);
2070     } else {
2071       warning("Unable to open cgroup memory limit file %s (%s)", lim_file, strerror(errno));
2072     }
2073   }
2074 
2075   // Convert deprecated flags
2076   if (FLAG_IS_DEFAULT(MaxRAMPercentage) &&
2077       !FLAG_IS_DEFAULT(MaxRAMFraction))
2078     MaxRAMPercentage = 100.0 / MaxRAMFraction;
2079 
2080   if (FLAG_IS_DEFAULT(MinRAMPercentage) &&
2081       !FLAG_IS_DEFAULT(MinRAMFraction))
2082     MinRAMPercentage = 100.0 / MinRAMFraction;
2083 
2084   if (FLAG_IS_DEFAULT(InitialRAMPercentage) &&
2085       !FLAG_IS_DEFAULT(InitialRAMFraction))
2086     InitialRAMPercentage = 100.0 / InitialRAMFraction;
2087 
2088   // If the maximum heap size has not been set with -Xmx,
2089   // then set it as fraction of the size of physical memory,
2090   // respecting the maximum and minimum sizes of the heap.
2091   if (FLAG_IS_DEFAULT(MaxHeapSize)) {
2092     julong reasonable_max = (julong)((phys_mem * MaxRAMPercentage) / 100);
2093     if (phys_mem <= (julong)((MaxHeapSize * MinRAMPercentage) / 100)) {

2094       // Small physical memory, so use a minimum fraction of it for the heap
2095       reasonable_max = (julong)((phys_mem * MinRAMPercentage) / 100);
2096     } else {
2097       // Not-small physical memory, so require a heap at least
2098       // as large as MaxHeapSize
2099       reasonable_max = MAX2(reasonable_max, (julong)MaxHeapSize);
2100     }
2101 
2102     if (!FLAG_IS_DEFAULT(ErgoHeapSizeLimit) && ErgoHeapSizeLimit != 0) {
2103       // Limit the heap size to ErgoHeapSizeLimit
2104       reasonable_max = MIN2(reasonable_max, (julong)ErgoHeapSizeLimit);
2105     }
2106     if (UseCompressedOops) {
2107       // Limit the heap size to the maximum possible when using compressed oops
2108       julong max_coop_heap = (julong)max_heap_for_compressed_oops();
2109 
2110       // HeapBaseMinAddress can be greater than default but not less than.
2111       if (!FLAG_IS_DEFAULT(HeapBaseMinAddress)) {
2112         if (HeapBaseMinAddress < DefaultHeapBaseMinAddress) {
2113           // matches compressed oops printing flags
2114           log_debug(gc, heap, coops)("HeapBaseMinAddress must be at least " SIZE_FORMAT
2115                                      " (" SIZE_FORMAT "G) which is greater than value given " SIZE_FORMAT,
2116                                      DefaultHeapBaseMinAddress,
2117                                      DefaultHeapBaseMinAddress/G,
2118                                      HeapBaseMinAddress);
2119           FLAG_SET_ERGO(size_t, HeapBaseMinAddress, DefaultHeapBaseMinAddress);
2120         }
2121       }


2134       // so be sure that the maximum size is consistent.  Done
2135       // after call to limit_by_allocatable_memory because that
2136       // method might reduce the allocation size.
2137       reasonable_max = MAX2(reasonable_max, (julong)InitialHeapSize);
2138     }
2139 
2140     log_trace(gc, heap)("  Maximum heap size " SIZE_FORMAT, (size_t) reasonable_max);
2141     FLAG_SET_ERGO(size_t, MaxHeapSize, (size_t)reasonable_max);
2142   }
2143 
2144   // If the minimum or initial heap_size have not been set or requested to be set
2145   // ergonomically, set them accordingly.
2146   if (InitialHeapSize == 0 || min_heap_size() == 0) {
2147     julong reasonable_minimum = (julong)(OldSize + NewSize);
2148 
2149     reasonable_minimum = MIN2(reasonable_minimum, (julong)MaxHeapSize);
2150 
2151     reasonable_minimum = limit_by_allocatable_memory(reasonable_minimum);
2152 
2153     if (InitialHeapSize == 0) {
2154       julong reasonable_initial = (julong)((phys_mem * InitialRAMPercentage) / 100);
2155 
2156       reasonable_initial = MAX3(reasonable_initial, reasonable_minimum, (julong)min_heap_size());
2157       reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize);
2158 
2159       reasonable_initial = limit_by_allocatable_memory(reasonable_initial);
2160 
2161       log_trace(gc, heap)("  Initial heap size " SIZE_FORMAT, (size_t)reasonable_initial);
2162       FLAG_SET_ERGO(size_t, InitialHeapSize, (size_t)reasonable_initial);
2163     }
2164     // If the minimum heap size has not been set (via -Xms),
2165     // synchronize with InitialHeapSize to avoid errors with the default value.
2166     if (min_heap_size() == 0) {
2167       set_min_heap_size(MIN2((size_t)reasonable_minimum, InitialHeapSize));
2168       log_trace(gc, heap)("  Minimum heap size " SIZE_FORMAT, min_heap_size());
2169     }
2170   }
2171 }
2172 
2173 // This option inspects the machine and attempts to set various
2174 // parameters to be optimal for long-running, memory allocation


hotspot/src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File