--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp Mon Mar 07 10:01:38 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp Mon Mar 07 12:49:35 2016 +0100
@@ -269,6 +269,8 @@
_reserve_regions = 0;
_cset_chooser = new CollectionSetChooser();
+
+ _ihop_control = create_ihop_control();
}
G1CollectorPolicy::~G1CollectorPolicy() {
@@ -469,8 +471,6 @@
if (max_young_size != MaxNewSize) {
FLAG_SET_ERGO(size_t, MaxNewSize, max_young_size);
}
-
- _ihop_control = create_ihop_control();
}
void G1CollectorPolicy::initialize_flags() {
@@ -565,6 +565,8 @@
_reserve_regions = (uint) ceil(reserve_regions_d);
_young_gen_sizer->heap_size_changed(new_number_of_regions);
+
+ _ihop_control->update_target_occupancy(new_number_of_regions * HeapRegion::GrainBytes);
}
uint G1CollectorPolicy::calculate_young_list_desired_min_length(
@@ -1234,13 +1236,11 @@
G1IHOPControl* G1CollectorPolicy::create_ihop_control() const {
if (G1UseAdaptiveIHOP) {
return new G1AdaptiveIHOPControl(InitiatingHeapOccupancyPercent,
- G1CollectedHeap::heap()->max_capacity(),
&_predictor,
G1ReservePercent,
G1HeapWastePercent);
} else {
- return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent,
- G1CollectedHeap::heap()->max_capacity());
+ return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent);
}
}
--- a/hotspot/src/share/vm/gc/g1/g1IHOPControl.cpp Mon Mar 07 10:01:38 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1IHOPControl.cpp Mon Mar 07 12:49:35 2016 +0100
@@ -29,15 +29,21 @@
#include "gc/shared/gcTrace.hpp"
#include "logging/log.hpp"
-G1IHOPControl::G1IHOPControl(double initial_ihop_percent, size_t target_occupancy) :
+G1IHOPControl::G1IHOPControl(double initial_ihop_percent) :
_initial_ihop_percent(initial_ihop_percent),
- _target_occupancy(target_occupancy),
+ _target_occupancy(0),
_last_allocated_bytes(0),
_last_allocation_time_s(0.0)
{
assert(_initial_ihop_percent >= 0.0 && _initial_ihop_percent <= 100.0, "Initial IHOP value must be between 0 and 100 but is %.3f", initial_ihop_percent);
}
+void G1IHOPControl::update_target_occupancy(size_t new_target_occupancy) {
+ log_debug(gc, ihop)("Target occupancy update: old: " SIZE_FORMAT "B, new: " SIZE_FORMAT "B",
+ _target_occupancy, new_target_occupancy);
+ _target_occupancy = new_target_occupancy;
+}
+
void G1IHOPControl::update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) {
assert(allocation_time_s >= 0.0, "Allocation time must be positive but is %.3f", allocation_time_s);
@@ -46,6 +52,7 @@
}
void G1IHOPControl::print() {
+ assert(_target_occupancy > 0, "Target occupancy still not updated yet.");
size_t cur_conc_mark_start_threshold = get_conc_mark_start_threshold();
log_debug(gc, ihop)("Basic information (value update), threshold: " SIZE_FORMAT "B (%1.2f), target occupancy: " SIZE_FORMAT "B, current occupancy: " SIZE_FORMAT "B, "
"recent allocation size: " SIZE_FORMAT "B, recent allocation duration: %1.2fms, recent old gen allocation rate: %1.2fB/s, recent marking phase length: %1.2fms",
@@ -60,6 +67,7 @@
}
void G1IHOPControl::send_trace_event(G1NewTracer* tracer) {
+ assert(_target_occupancy > 0, "Target occupancy still not updated yet.");
tracer->report_basic_ihop_statistics(get_conc_mark_start_threshold(),
_target_occupancy,
G1CollectedHeap::heap()->used(),
@@ -68,10 +76,9 @@
last_marking_length_s());
}
-G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent, size_t target_occupancy) :
- G1IHOPControl(ihop_percent, target_occupancy),
+G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent) :
+ G1IHOPControl(ihop_percent),
_last_marking_length_s(0.0) {
- assert(_target_occupancy > 0, "Target occupancy must be larger than zero.");
}
#ifndef PRODUCT
@@ -85,7 +92,8 @@
void G1StaticIHOPControl::test() {
size_t const initial_ihop = 45;
- G1StaticIHOPControl ctrl(initial_ihop, 100);
+ G1StaticIHOPControl ctrl(initial_ihop);
+ ctrl.update_target_occupancy(100);
size_t threshold = ctrl.get_conc_mark_start_threshold();
assert(threshold == initial_ihop,
@@ -115,11 +123,10 @@
#endif
G1AdaptiveIHOPControl::G1AdaptiveIHOPControl(double ihop_percent,
- size_t initial_target_occupancy,
G1Predictions const* predictor,
size_t heap_reserve_percent,
size_t heap_waste_percent) :
- G1IHOPControl(ihop_percent, initial_target_occupancy),
+ G1IHOPControl(ihop_percent),
_predictor(predictor),
_marking_times_s(10, 0.95),
_allocation_rate_s(10, 0.95),
@@ -130,6 +137,7 @@
}
size_t G1AdaptiveIHOPControl::actual_target_threshold() const {
+ guarantee(_target_occupancy > 0, "Target occupancy still not updated yet.");
// The actual target threshold takes the heap reserve and the expected waste in
// free space into account.
// _heap_reserve is that part of the total heap capacity that is reserved for
@@ -227,7 +235,8 @@
// target_size - (young_size + alloc_amount/alloc_time * marking_time)
G1Predictions pred(0.95);
- G1AdaptiveIHOPControl ctrl(initial_threshold, target_size, &pred, 0, 0);
+ G1AdaptiveIHOPControl ctrl(initial_threshold, &pred, 0, 0);
+ ctrl.update_target_occupancy(target_size);
// First "load".
size_t const alloc_time1 = 2;
@@ -288,5 +297,6 @@
void IHOP_test() {
G1StaticIHOPControl::test();
+ G1AdaptiveIHOPControl::test();
}
#endif
--- a/hotspot/src/share/vm/gc/g1/g1IHOPControl.hpp Mon Mar 07 10:01:38 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1IHOPControl.hpp Mon Mar 07 12:49:35 2016 +0100
@@ -38,7 +38,8 @@
protected:
// The initial IHOP value relative to the target occupancy.
double _initial_ihop_percent;
- // The target maximum occupancy of the heap.
+ // The target maximum occupancy of the heap. The target occupancy is the number
+ // of bytes when marking should be finished and reclaim started.
size_t _target_occupancy;
// Most recent complete mutator allocation period in seconds.
@@ -46,10 +47,9 @@
// Amount of bytes allocated during _last_allocation_time_s.
size_t _last_allocated_bytes;
- // Initialize an instance with the initial IHOP value in percent and the target
- // occupancy. The target occupancy is the number of bytes when marking should
- // be finished and reclaim started.
- G1IHOPControl(double initial_ihop_percent, size_t target_occupancy);
+ // Initialize an instance with the initial IHOP value in percent. The target
+ // occupancy will be updated at the first heap expansion.
+ G1IHOPControl(double initial_ihop_percent);
// Most recent time from the end of the initial mark to the start of the first
// mixed gc.
@@ -60,6 +60,8 @@
// Get the current non-young occupancy at which concurrent marking should start.
virtual size_t get_conc_mark_start_threshold() = 0;
+ // Adjust target occupancy.
+ virtual void update_target_occupancy(size_t new_target_occupancy);
// Update information about time during which allocations in the Java heap occurred,
// how large these allocations were in bytes, and an additional buffer.
// The allocations should contain any amount of space made unusable for further
@@ -86,9 +88,12 @@
protected:
double last_marking_length_s() const { return _last_marking_length_s; }
public:
- G1StaticIHOPControl(double ihop_percent, size_t target_occupancy);
+ G1StaticIHOPControl(double ihop_percent);
- size_t get_conc_mark_start_threshold() { return (size_t) (_initial_ihop_percent * _target_occupancy / 100.0); }
+ size_t get_conc_mark_start_threshold() {
+ guarantee(_target_occupancy > 0, "Target occupancy must have been initialized.");
+ return (size_t) (_initial_ihop_percent * _target_occupancy / 100.0);
+ }
virtual void update_marking_length(double marking_length_s) {
assert(marking_length_s > 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s);
@@ -132,7 +137,6 @@
virtual double last_marking_length_s() const { return _marking_times_s.last(); }
public:
G1AdaptiveIHOPControl(double ihop_percent,
- size_t initial_target_occupancy,
G1Predictions const* predictor,
size_t heap_reserve_percent, // The percentage of total heap capacity that should not be tapped into.
size_t heap_waste_percent); // The percentage of the free space in the heap that we think is not usable for allocation.
--- a/hotspot/test/TEST.groups Mon Mar 07 10:01:38 2016 +0000
+++ b/hotspot/test/TEST.groups Mon Mar 07 12:49:35 2016 +0100
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2016, 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
@@ -230,8 +230,10 @@
#
needs_g1gc = \
compiler/regalloc/C1ObjectSpillInLogicOp.java \
+ gc/TestSmallHeap.java \
gc/TestSystemGC.java \
gc/arguments/TestAlignmentToUseLargePages.java \
+ gc/arguments/TestG1ConcRefinementThreads.java \
gc/arguments/TestG1HeapRegionSize.java \
gc/arguments/TestG1HeapSizeFlags.java \
gc/arguments/TestG1PercentageOptions.java \
@@ -242,11 +244,11 @@
gc/class_unloading/TestG1ClassUnloadingHWM.java \
gc/ergonomics/TestDynamicNumberOfGCThreads.java \
gc/g1/ \
+ gc/logging/TestGCId.java \
gc/metaspace/G1AddMetaspaceDependency.java \
gc/metaspace/TestMetaspacePerfCounters.java \
gc/startup_warnings/TestG1.java \
- gc/whitebox/TestConcMarkCycleWB.java \
- gc/arguments/TestG1ConcRefinementThreads.java
+ gc/whitebox/TestConcMarkCycleWB.java
hotspot_native_sanity = \
native_sanity
--- a/hotspot/test/gc/TestCardTablePageCommits.java Mon Mar 07 10:01:38 2016 +0000
+++ b/hotspot/test/gc/TestCardTablePageCommits.java Mon Mar 07 12:49:35 2016 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2014, 2016, 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
@@ -31,6 +31,7 @@
* @key gc
* @bug 8059066
* @summary Tests that the card table does not commit the same page twice
+ * @requires vm.gc=="Parallel" | vm.gc=="null"
* @library /testlibrary
* @modules java.base/sun.misc
* java.management
--- a/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java Mon Mar 07 10:01:38 2016 +0000
+++ b/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java Mon Mar 07 12:49:35 2016 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2016, 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
@@ -25,6 +25,7 @@
* @test TestCMSHeapSizeFlags
* @key gc
* @bug 8006088
+ * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null"
* @summary Tests argument processing for initial and maximum heap size for the CMS collector
* @library /testlibrary /test/lib
* @modules java.base/sun.misc
--- a/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java Mon Mar 07 10:01:38 2016 +0000
+++ b/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java Mon Mar 07 12:49:35 2016 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2014, 2016, 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
@@ -25,6 +25,7 @@
* @test TestG1ConcRefinementThreads
* @key gc
* @bug 8047976
+ * @requires vm.gc=="G1" | vm.gc=="null"
* @summary Tests argument processing for G1ConcRefinementThreads
* @library /testlibrary
* @modules java.base/sun.misc
--- a/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java Mon Mar 07 10:01:38 2016 +0000
+++ b/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java Mon Mar 07 12:49:35 2016 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2016, 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
@@ -25,6 +25,7 @@
* @test TestG1HeapSizeFlags
* @key gc
* @bug 8006088
+ * @requires vm.gc=="G1" | vm.gc=="null"
* @summary Tests argument processing for initial and maximum heap size for the G1 collector
* @library /testlibrary /test/lib
* @modules java.base/sun.misc
--- a/hotspot/test/gc/arguments/TestG1PercentageOptions.java Mon Mar 07 10:01:38 2016 +0000
+++ b/hotspot/test/gc/arguments/TestG1PercentageOptions.java Mon Mar 07 12:49:35 2016 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2016, 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
@@ -25,6 +25,7 @@
* @test TestG1PercentageOptions
* @key gc
* @bug 8068942
+ * @requires vm.gc=="G1" | vm.gc=="null"
* @summary Test argument processing of various percentage options
* @library /testlibrary
* @modules java.base/sun.misc
--- a/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java Mon Mar 07 10:01:38 2016 +0000
+++ b/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java Mon Mar 07 12:49:35 2016 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2016, 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
@@ -27,6 +27,7 @@
* @bug 8006088
* @summary Tests argument processing for initial and maximum heap size for the
* parallel collectors.
+ * @requires vm.gc=="null"
* @library /testlibrary /test/lib
* @modules java.base/sun.misc
* java.management
--- a/hotspot/test/gc/logging/TestGCId.java Mon Mar 07 10:01:38 2016 +0000
+++ b/hotspot/test/gc/logging/TestGCId.java Mon Mar 07 12:49:35 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -25,6 +25,7 @@
* @test TestGCId
* @bug 8043607
* @summary Ensure that the GCId is logged
+ * @requires vm.gc=="null"
* @key gc
* @library /testlibrary
* @modules java.base/sun.misc