< prev index next >

src/hotspot/share/gc/parallel/parallelArguments.cpp

Print this page

  9  *
 10  * This code is distributed in the hope that it will be useful, but WITHOUT
 11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 13  * version 2 for more details (a copy is included in the LICENSE file that
 14  * accompanied this code).
 15  *
 16  * You should have received a copy of the GNU General Public License version
 17  * 2 along with this work; if not, write to the Free Software Foundation,
 18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.
 23  *
 24  */
 25 
 26 #include "gc/parallel/parallelArguments.hpp"
 27 #include "gc/parallel/parallelScavengeHeap.hpp"
 28 #include "gc/shared/adaptiveSizePolicy.hpp"
 29 #include "gc/shared/fullGCForwarding.hpp"
 30 #include "gc/shared/gcArguments.hpp"
 31 #include "gc/shared/genArguments.hpp"
 32 #include "gc/shared/workerPolicy.hpp"
 33 #include "logging/log.hpp"
 34 #include "runtime/globals.hpp"
 35 #include "runtime/globals_extension.hpp"
 36 #include "runtime/java.hpp"
 37 #include "utilities/defaultStream.hpp"
 38 #include "utilities/powerOfTwo.hpp"
 39 
 40 static size_t num_young_spaces() {
 41   // When using NUMA, we create one MutableNUMASpace for each NUMA node
 42   const size_t num_eden_spaces = UseNUMA ? os::numa_get_groups_num() : 1;
 43 
 44   // The young generation must have room for eden + two survivors
 45   return num_eden_spaces + 2;
 46 }
 47 
 48 static size_t num_old_spaces() {
 49   return 1;

110           "Inconsistent MinSurvivorRatio vs InitialSurvivorRatio: %zu vs %zu\n", MinSurvivorRatio, InitialSurvivorRatio);
111       }
112       FLAG_SET_DEFAULT(MinSurvivorRatio, InitialSurvivorRatio);
113     } else {
114       FLAG_SET_DEFAULT(InitialSurvivorRatio, MinSurvivorRatio);
115     }
116   }
117 
118   // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the
119   // SurvivorRatio has been set, reset their default values to SurvivorRatio +
120   // 2.  By doing this we make SurvivorRatio also work for Parallel Scavenger.
121   // See CR 6362902 for details.
122   if (!FLAG_IS_DEFAULT(SurvivorRatio)) {
123     if (FLAG_IS_DEFAULT(InitialSurvivorRatio)) {
124        FLAG_SET_DEFAULT(InitialSurvivorRatio, SurvivorRatio + 2);
125     }
126     if (FLAG_IS_DEFAULT(MinSurvivorRatio)) {
127       FLAG_SET_DEFAULT(MinSurvivorRatio, SurvivorRatio + 2);
128     }
129   }
130 
131   FullGCForwarding::initialize_flags(heap_reserved_size_bytes());
132 }
133 
134 size_t ParallelArguments::conservative_max_heap_alignment() {
135   // The card marking array and the offset arrays for old generations are
136   // committed in os pages as well. Make sure they are entirely full (to
137   // avoid partial page problems), e.g. if 512 bytes heap corresponds to 1
138   // byte entry and the os page size is 4096, the maximum heap size should
139   // be 512*4096 = 2MB aligned.
140 
141   size_t alignment = CardTable::ct_max_alignment_constraint();
142 
143   if (UseLargePages) {
144       // In presence of large pages we have to make sure that our
145       // alignment is large page aware.
146       alignment = lcm(os::large_page_size(), alignment);
147   }
148 
149   return alignment;
150 }
151 

  9  *
 10  * This code is distributed in the hope that it will be useful, but WITHOUT
 11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 13  * version 2 for more details (a copy is included in the LICENSE file that
 14  * accompanied this code).
 15  *
 16  * You should have received a copy of the GNU General Public License version
 17  * 2 along with this work; if not, write to the Free Software Foundation,
 18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.
 23  *
 24  */
 25 
 26 #include "gc/parallel/parallelArguments.hpp"
 27 #include "gc/parallel/parallelScavengeHeap.hpp"
 28 #include "gc/shared/adaptiveSizePolicy.hpp"

 29 #include "gc/shared/gcArguments.hpp"
 30 #include "gc/shared/genArguments.hpp"
 31 #include "gc/shared/workerPolicy.hpp"
 32 #include "logging/log.hpp"
 33 #include "runtime/globals.hpp"
 34 #include "runtime/globals_extension.hpp"
 35 #include "runtime/java.hpp"
 36 #include "utilities/defaultStream.hpp"
 37 #include "utilities/powerOfTwo.hpp"
 38 
 39 static size_t num_young_spaces() {
 40   // When using NUMA, we create one MutableNUMASpace for each NUMA node
 41   const size_t num_eden_spaces = UseNUMA ? os::numa_get_groups_num() : 1;
 42 
 43   // The young generation must have room for eden + two survivors
 44   return num_eden_spaces + 2;
 45 }
 46 
 47 static size_t num_old_spaces() {
 48   return 1;

109           "Inconsistent MinSurvivorRatio vs InitialSurvivorRatio: %zu vs %zu\n", MinSurvivorRatio, InitialSurvivorRatio);
110       }
111       FLAG_SET_DEFAULT(MinSurvivorRatio, InitialSurvivorRatio);
112     } else {
113       FLAG_SET_DEFAULT(InitialSurvivorRatio, MinSurvivorRatio);
114     }
115   }
116 
117   // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the
118   // SurvivorRatio has been set, reset their default values to SurvivorRatio +
119   // 2.  By doing this we make SurvivorRatio also work for Parallel Scavenger.
120   // See CR 6362902 for details.
121   if (!FLAG_IS_DEFAULT(SurvivorRatio)) {
122     if (FLAG_IS_DEFAULT(InitialSurvivorRatio)) {
123        FLAG_SET_DEFAULT(InitialSurvivorRatio, SurvivorRatio + 2);
124     }
125     if (FLAG_IS_DEFAULT(MinSurvivorRatio)) {
126       FLAG_SET_DEFAULT(MinSurvivorRatio, SurvivorRatio + 2);
127     }
128   }


129 }
130 
131 size_t ParallelArguments::conservative_max_heap_alignment() {
132   // The card marking array and the offset arrays for old generations are
133   // committed in os pages as well. Make sure they are entirely full (to
134   // avoid partial page problems), e.g. if 512 bytes heap corresponds to 1
135   // byte entry and the os page size is 4096, the maximum heap size should
136   // be 512*4096 = 2MB aligned.
137 
138   size_t alignment = CardTable::ct_max_alignment_constraint();
139 
140   if (UseLargePages) {
141       // In presence of large pages we have to make sure that our
142       // alignment is large page aware.
143       alignment = lcm(os::large_page_size(), alignment);
144   }
145 
146   return alignment;
147 }
148 
< prev index next >