Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8243315: ParallelScavengeHeap::initialize() passes GenAlignment as page size to os::trace_page_sizes instead of actual page size #1161

Closed
wants to merge 9 commits into from
@@ -0,0 +1,44 @@
/*

Check failure on line 1 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 2: carriage return (^M)
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.

Check failure on line 2 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 73: carriage return (^M)
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

Check failure on line 3 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 64: carriage return (^M)
*

Check failure on line 4 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 2: carriage return (^M)
* This code is free software; you can redistribute it and/or modify it

Check failure on line 5 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 71: carriage return (^M)
* under the terms of the GNU General Public License version 2 only, as

Check failure on line 6 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 71: carriage return (^M)
* published by the Free Software Foundation.

Check failure on line 7 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 45: carriage return (^M)
*

Check failure on line 8 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 2: carriage return (^M)
* This code is distributed in the hope that it will be useful, but WITHOUT

Check failure on line 9 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 75: carriage return (^M)
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or

Check failure on line 10 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 72: carriage return (^M)
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License

Check failure on line 11 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 72: carriage return (^M)
* version 2 for more details (a copy is included in the LICENSE file that

Check failure on line 12 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 74: carriage return (^M)
* accompanied this code).

Check failure on line 13 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 26: carriage return (^M)
*

Check failure on line 14 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 2: carriage return (^M)
* You should have received a copy of the GNU General Public License version

Check failure on line 15 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 76: carriage return (^M)
* 2 along with this work; if not, write to the Free Software Foundation,

Check failure on line 16 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 73: carriage return (^M)
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.

Check failure on line 17 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 64: carriage return (^M)
*

Check failure on line 18 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 2: carriage return (^M)
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA

Check failure on line 19 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 74: carriage return (^M)
* or visit www.oracle.com if you need additional information or have any

Check failure on line 20 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 73: carriage return (^M)
* questions.

Check failure on line 21 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 13: carriage return (^M)
*

Check failure on line 22 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 2: carriage return (^M)
*/

Check failure on line 23 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 3: carriage return (^M)

Check failure on line 24 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 0: carriage return (^M)
#include "precompiled.hpp"

Check failure on line 25 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 26: carriage return (^M)
#include "gc/parallel/parallelInitLogger.hpp"

Check failure on line 26 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 45: carriage return (^M)
#include "gc/shared/gcLogPrecious.hpp"

Check failure on line 27 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 38: carriage return (^M)

Check failure on line 28 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 0: carriage return (^M)
void ParallelInitLogger::print_gc_specific() {

Check failure on line 29 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 46: carriage return (^M)
log_info_p(gc, init)("Alignments: "

Check failure on line 30 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 37: carriage return (^M)
" space_align=" SIZE_FORMAT "%s"

Check failure on line 31 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 53: carriage return (^M)
" gen_align=" SIZE_FORMAT "%s"

Check failure on line 32 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 51: carriage return (^M)
" heap_align=" SIZE_FORMAT "%s",

Check failure on line 33 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 53: carriage return (^M)
byte_size_in_exact_unit(SpaceAlignment), exact_unit_for_byte_size(SpaceAlignment),

Check failure on line 34 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 103: carriage return (^M)
byte_size_in_exact_unit(GenAlignment), exact_unit_for_byte_size(GenAlignment),

Check failure on line 35 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 99: carriage return (^M)
byte_size_in_exact_unit(HeapAlignment), exact_unit_for_byte_size(HeapAlignment)

Check failure on line 36 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 100: carriage return (^M)
);

Check failure on line 37 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 23: carriage return (^M)
GCInitLogger::print_gc_specific();

Check failure on line 38 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 36: carriage return (^M)
}

Check failure on line 39 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 1: carriage return (^M)

Check failure on line 40 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 0: carriage return (^M)
void ParallelInitLogger::print() {

Check failure on line 41 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 34: carriage return (^M)
ParallelInitLogger init_log;

Check failure on line 42 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 30: carriage return (^M)
init_log.print_all();

Check failure on line 43 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 23: carriage return (^M)
}

Check failure on line 44 in src/hotspot/share/gc/parallel/parallelInitLogger.cpp

openjdk / jcheck

Whitespace error

Column 1: carriage return (^M)
@@ -0,0 +1,39 @@
/*

Check failure on line 1 in src/hotspot/share/gc/parallel/parallelInitLogger.hpp

openjdk / jcheck

Whitespace error

Column 2: carriage return (^M)
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.

Check failure on line 2 in src/hotspot/share/gc/parallel/parallelInitLogger.hpp

openjdk / jcheck

Whitespace error

Column 73: carriage return (^M)
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

Check failure on line 3 in src/hotspot/share/gc/parallel/parallelInitLogger.hpp

openjdk / jcheck

Whitespace error

Column 64: carriage return (^M)
*

Check failure on line 4 in src/hotspot/share/gc/parallel/parallelInitLogger.hpp

openjdk / jcheck

Whitespace error

Column 2: carriage return (^M)
* This code is free software; you can redistribute it and/or modify it

Check failure on line 5 in src/hotspot/share/gc/parallel/parallelInitLogger.hpp

openjdk / jcheck

Whitespace error

Column 71: carriage return (^M)
* under the terms of the GNU General Public License version 2 only, as

Check failure on line 6 in src/hotspot/share/gc/parallel/parallelInitLogger.hpp

openjdk / jcheck

Whitespace error

Column 71: carriage return (^M)
* 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();
//virtual void print_workers();
virtual void print_gc_specific();
public:
static void print();
};

#endif //SHARE_GC_PARALLEL_PARALLELINITLOGGER_HPP
@@ -63,12 +63,7 @@ jint ParallelScavengeHeap::initialize() {

ReservedHeapSpace heap_rs = Universe::reserve_heap(reserved_heap_size, HeapAlignment);

os::trace_page_sizes("Heap",
MinHeapSize,
reserved_heap_size,
os::vm_page_size(),
heap_rs.base(),
heap_rs.size());
trace_actual_reserved_page_size(reserved_heap_size, heap_rs);

initialize_reserved_region(heap_rs);

@@ -684,6 +679,32 @@ void ParallelScavengeHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_trac
gc_tracer->report_metaspace_summary(when, metaspace_summary);
}

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)) {
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());
}
}
Copy link
Contributor

@kstefanj kstefanj Nov 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is exactly the same code as in actual_reserved_page_size() in g1CollectedHeap.cpp I think we should lift it out to a helper that can be used by both G1 and Parallel. Not entirely sure where the best location for such helper is, but a static function ReservedSpace::actual_page_size(ReservedSpace) could work.

os::trace_page_sizes("Heap",
MinHeapSize,
reserved_heap_size,
page_size,
rs.base(),
rs.size());
Copy link
Contributor

@kstefanj kstefanj Nov 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation is one off.

}
}

CardTableBarrierSet* ParallelScavengeHeap::barrier_set() {
return barrier_set_cast<CardTableBarrierSet>(BarrierSet::barrier_set());
}
@@ -77,6 +77,7 @@ class ParallelScavengeHeap : public CollectedHeap {
virtual void initialize_serviceability();

void trace_heap(GCWhen::Type when, const GCTracer* tracer);
void trace_actual_reserved_page_size(const size_t reserved_heap_size, const ReservedSpace rs);

protected:
static inline size_t total_invocations();