8243315: ParallelScavengeHeap::initialize() passes GenAlignment as page size to os::trace_page_sizes instead of actual page size
Reviewed-by: sjohanss, tschatzl
This commit is contained in:
parent
cdb41ba1d0
commit
8cd2e0f694
@ -1476,32 +1476,13 @@ G1CollectedHeap::G1CollectedHeap() :
|
||||
guarantee(_task_queues != NULL, "task_queues allocation failure.");
|
||||
}
|
||||
|
||||
static size_t actual_reserved_page_size(ReservedSpace rs) {
|
||||
size_t page_size = os::vm_page_size();
|
||||
if (UseLargePages) {
|
||||
// There are two ways to manage large page memory.
|
||||
// 1. OS supports committing large page memory.
|
||||
// 2. OS doesn't support committing large page memory so ReservedSpace manages it.
|
||||
// And ReservedSpace calls it 'special'. If we failed to set 'special',
|
||||
// we reserved memory without large page.
|
||||
if (os::can_commit_large_page_memory() || rs.special()) {
|
||||
// An alignment at ReservedSpace comes from preferred page size or
|
||||
// heap alignment, and if the alignment came from heap alignment, it could be
|
||||
// larger than large pages size. So need to cap with the large page size.
|
||||
page_size = MIN2(rs.alignment(), os::large_page_size());
|
||||
}
|
||||
}
|
||||
|
||||
return page_size;
|
||||
}
|
||||
|
||||
G1RegionToSpaceMapper* G1CollectedHeap::create_aux_memory_mapper(const char* description,
|
||||
size_t size,
|
||||
size_t translation_factor) {
|
||||
size_t preferred_page_size = os::page_size_for_region_unaligned(size, 1);
|
||||
// Allocate a new reserved space, preferring to use large pages.
|
||||
ReservedSpace rs(size, preferred_page_size);
|
||||
size_t page_size = actual_reserved_page_size(rs);
|
||||
size_t page_size = ReservedSpace::actual_reserved_page_size(rs);
|
||||
G1RegionToSpaceMapper* result =
|
||||
G1RegionToSpaceMapper::create_mapper(rs,
|
||||
size,
|
||||
@ -1593,7 +1574,7 @@ jint G1CollectedHeap::initialize() {
|
||||
_hot_card_cache = new G1HotCardCache(this);
|
||||
|
||||
// Create space mappers.
|
||||
size_t page_size = actual_reserved_page_size(heap_rs);
|
||||
size_t page_size = ReservedSpace::actual_reserved_page_size(heap_rs);
|
||||
G1RegionToSpaceMapper* heap_storage =
|
||||
G1RegionToSpaceMapper::create_mapper(heap_rs,
|
||||
heap_rs.size(),
|
||||
|
44
src/hotspot/share/gc/parallel/parallelInitLogger.cpp
Normal file
44
src/hotspot/share/gc/parallel/parallelInitLogger.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 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.
|
||||
*
|
||||
* 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 "precompiled.hpp"
|
||||
#include "gc/parallel/parallelInitLogger.hpp"
|
||||
#include "gc/shared/genArguments.hpp"
|
||||
#include "gc/shared/gcLogPrecious.hpp"
|
||||
|
||||
void ParallelInitLogger::print_heap() {
|
||||
log_info_p(gc, init)("Alignments:"
|
||||
" Space " SIZE_FORMAT "%s,"
|
||||
" Generation " SIZE_FORMAT "%s,"
|
||||
" Heap " SIZE_FORMAT "%s",
|
||||
byte_size_in_exact_unit(SpaceAlignment), exact_unit_for_byte_size(SpaceAlignment),
|
||||
byte_size_in_exact_unit(GenAlignment), exact_unit_for_byte_size(GenAlignment),
|
||||
byte_size_in_exact_unit(HeapAlignment), exact_unit_for_byte_size(HeapAlignment));
|
||||
GCInitLogger::print_heap();
|
||||
}
|
||||
|
||||
void ParallelInitLogger::print() {
|
||||
ParallelInitLogger init_log;
|
||||
init_log.print_all();
|
||||
}
|
37
src/hotspot/share/gc/parallel/parallelInitLogger.hpp
Normal file
37
src/hotspot/share/gc/parallel/parallelInitLogger.hpp
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 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.
|
||||
*
|
||||
* 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 SHARE_GC_PARALLEL_PARALLELINITLOGGER_HPP
|
||||
#define SHARE_GC_PARALLEL_PARALLELINITLOGGER_HPP
|
||||
|
||||
#include "gc/shared/gcInitLogger.hpp"
|
||||
|
||||
class ParallelInitLogger : public GCInitLogger {
|
||||
protected:
|
||||
virtual void print_heap();
|
||||
public:
|
||||
static void print();
|
||||
};
|
||||
|
||||
#endif //SHARE_GC_PARALLEL_PARALLELINITLOGGER_HPP
|
@ -26,6 +26,7 @@
|
||||
#include "code/codeCache.hpp"
|
||||
#include "gc/parallel/parallelArguments.hpp"
|
||||
#include "gc/parallel/objectStartArray.inline.hpp"
|
||||
#include "gc/parallel/parallelInitLogger.hpp"
|
||||
#include "gc/parallel/parallelScavengeHeap.inline.hpp"
|
||||
#include "gc/parallel/psAdaptiveSizePolicy.hpp"
|
||||
#include "gc/parallel/psMemoryPool.hpp"
|
||||
@ -63,12 +64,7 @@ jint ParallelScavengeHeap::initialize() {
|
||||
|
||||
ReservedHeapSpace heap_rs = Universe::reserve_heap(reserved_heap_size, HeapAlignment);
|
||||
|
||||
os::trace_page_sizes("Heap",
|
||||
MinHeapSize,
|
||||
reserved_heap_size,
|
||||
GenAlignment,
|
||||
heap_rs.base(),
|
||||
heap_rs.size());
|
||||
trace_actual_reserved_page_size(reserved_heap_size, heap_rs);
|
||||
|
||||
initialize_reserved_region(heap_rs);
|
||||
|
||||
@ -133,7 +129,7 @@ jint ParallelScavengeHeap::initialize() {
|
||||
return JNI_ENOMEM;
|
||||
}
|
||||
|
||||
GCInitLogger::print();
|
||||
ParallelInitLogger::print();
|
||||
|
||||
return JNI_OK;
|
||||
}
|
||||
@ -739,6 +735,19 @@ void ParallelScavengeHeap::verify(VerifyOption option /* ignored */) {
|
||||
}
|
||||
}
|
||||
|
||||
void ParallelScavengeHeap::trace_actual_reserved_page_size(const size_t reserved_heap_size, const ReservedSpace rs) {
|
||||
// Check if Info level is enabled, since os::trace_page_sizes() logs on Info level.
|
||||
if(log_is_enabled(Info, pagesize)) {
|
||||
const size_t page_size = ReservedSpace::actual_reserved_page_size(rs);
|
||||
os::trace_page_sizes("Heap",
|
||||
MinHeapSize,
|
||||
reserved_heap_size,
|
||||
page_size,
|
||||
rs.base(),
|
||||
rs.size());
|
||||
}
|
||||
}
|
||||
|
||||
void ParallelScavengeHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) {
|
||||
const PSHeapSummary& heap_summary = create_ps_heap_summary();
|
||||
gc_tracer->report_gc_heap_summary(when, heap_summary);
|
||||
|
@ -77,6 +77,7 @@ class ParallelScavengeHeap : public CollectedHeap {
|
||||
|
||||
virtual void initialize_serviceability();
|
||||
|
||||
void trace_actual_reserved_page_size(const size_t reserved_heap_size, const ReservedSpace rs);
|
||||
void trace_heap(GCWhen::Type when, const GCTracer* tracer);
|
||||
|
||||
protected:
|
||||
|
@ -286,6 +286,24 @@ size_t ReservedSpace::allocation_align_size_up(size_t size) {
|
||||
return align_up(size, os::vm_allocation_granularity());
|
||||
}
|
||||
|
||||
size_t ReservedSpace::actual_reserved_page_size(const ReservedSpace& rs) {
|
||||
size_t page_size = os::vm_page_size();
|
||||
if (UseLargePages) {
|
||||
// There are two ways to manage large page memory.
|
||||
// 1. OS supports committing large page memory.
|
||||
// 2. OS doesn't support committing large page memory so ReservedSpace manages it.
|
||||
// And ReservedSpace calls it 'special'. If we failed to set 'special',
|
||||
// we reserved memory without large page.
|
||||
if (os::can_commit_large_page_memory() || rs.special()) {
|
||||
// An alignment at ReservedSpace comes from preferred page size or
|
||||
// heap alignment, and if the alignment came from heap alignment, it could be
|
||||
// larger than large pages size. So need to cap with the large page size.
|
||||
page_size = MIN2(rs.alignment(), os::large_page_size());
|
||||
}
|
||||
}
|
||||
|
||||
return page_size;
|
||||
}
|
||||
|
||||
void ReservedSpace::release() {
|
||||
if (is_reserved()) {
|
||||
|
@ -96,6 +96,8 @@ class ReservedSpace {
|
||||
bool contains(const void* p) const {
|
||||
return (base() <= ((char*)p)) && (((char*)p) < (base() + size()));
|
||||
}
|
||||
|
||||
static size_t actual_reserved_page_size(const ReservedSpace& rs);
|
||||
};
|
||||
|
||||
ReservedSpace
|
||||
|
Loading…
Reference in New Issue
Block a user