< prev index next >

src/hotspot/share/gc/g1/g1Policy.cpp

Print this page
rev 53416 : imported patch 8217330-split-collectionsetchooser
rev 53417 : [mq]: 8217330-leo-review
rev 53418 : imported patch 8217328-rename-collectionsetchooser


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

  30 #include "gc/g1/g1ConcurrentMark.hpp"
  31 #include "gc/g1/g1ConcurrentMarkThread.inline.hpp"
  32 #include "gc/g1/g1ConcurrentRefine.hpp"
  33 #include "gc/g1/g1HeterogeneousHeapPolicy.hpp"
  34 #include "gc/g1/g1HotCardCache.hpp"
  35 #include "gc/g1/g1IHOPControl.hpp"
  36 #include "gc/g1/g1GCPhaseTimes.hpp"
  37 #include "gc/g1/g1Policy.hpp"
  38 #include "gc/g1/g1SurvivorRegions.hpp"
  39 #include "gc/g1/g1YoungGenSizer.hpp"
  40 #include "gc/g1/heapRegion.inline.hpp"
  41 #include "gc/g1/heapRegionRemSet.hpp"
  42 #include "gc/shared/gcPolicyCounters.hpp"
  43 #include "logging/logStream.hpp"
  44 #include "runtime/arguments.hpp"
  45 #include "runtime/java.hpp"
  46 #include "runtime/mutexLocker.hpp"
  47 #include "utilities/debug.hpp"
  48 #include "utilities/growableArray.hpp"
  49 #include "utilities/pair.hpp"


1010       log_debug(gc, ergo)("Initiate concurrent cycle (user requested concurrent cycle)");
1011     } else {
1012       // The concurrent marking thread is still finishing up the
1013       // previous cycle. If we start one right now the two cycles
1014       // overlap. In particular, the concurrent marking thread might
1015       // be in the process of clearing the next marking bitmap (which
1016       // we will use for the next cycle if we start one). Starting a
1017       // cycle now will be bad given that parts of the marking
1018       // information might get cleared by the marking thread. And we
1019       // cannot wait for the marking thread to finish the cycle as it
1020       // periodically yields while clearing the next marking bitmap
1021       // and, if it's in a yield point, it's waiting for us to
1022       // finish. So, at this point we will not start a cycle and we'll
1023       // let the concurrent marking thread complete the last one.
1024       log_debug(gc, ergo)("Do not initiate concurrent cycle (concurrent cycle already in progress)");
1025     }
1026   }
1027 }
1028 
1029 void G1Policy::record_concurrent_mark_cleanup_end() {
1030   G1CollectionSetCandidates* candidates = CollectionSetChooser::build(_g1h->workers(), _g1h->num_regions());
1031   _collection_set->set_candidates(candidates);
1032 
1033   bool mixed_gc_pending = next_gc_should_be_mixed("request mixed gcs", "request young-only gcs");
1034   if (!mixed_gc_pending) {
1035     clear_collection_set_candidates();
1036     abort_time_to_mixed_tracking();
1037   }
1038   collector_state()->set_in_young_gc_before_mixed(mixed_gc_pending);
1039   collector_state()->set_mark_or_rebuild_in_progress(false);
1040 
1041   double end_sec = os::elapsedTime();
1042   double elapsed_time_ms = (end_sec - _mark_cleanup_start_sec) * 1000.0;
1043   _analytics->report_concurrent_mark_cleanup_times_ms(elapsed_time_ms);
1044   _analytics->append_prev_collection_pause_end_ms(elapsed_time_ms);
1045 
1046   record_pause(Cleanup, _mark_cleanup_start_sec, end_sec);
1047 }
1048 
1049 double G1Policy::reclaimable_bytes_percent(size_t reclaimable_bytes) const {
1050   return percent_of(reclaimable_bytes, _g1h->capacity());




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

  26 #include "gc/g1/g1Analytics.hpp"
  27 #include "gc/g1/g1CollectedHeap.inline.hpp"
  28 #include "gc/g1/g1CollectionSet.hpp"
  29 #include "gc/g1/g1CollectionSetChooser.hpp"
  30 #include "gc/g1/g1ConcurrentMark.hpp"
  31 #include "gc/g1/g1ConcurrentMarkThread.inline.hpp"
  32 #include "gc/g1/g1ConcurrentRefine.hpp"
  33 #include "gc/g1/g1HeterogeneousHeapPolicy.hpp"
  34 #include "gc/g1/g1HotCardCache.hpp"
  35 #include "gc/g1/g1IHOPControl.hpp"
  36 #include "gc/g1/g1GCPhaseTimes.hpp"
  37 #include "gc/g1/g1Policy.hpp"
  38 #include "gc/g1/g1SurvivorRegions.hpp"
  39 #include "gc/g1/g1YoungGenSizer.hpp"
  40 #include "gc/g1/heapRegion.inline.hpp"
  41 #include "gc/g1/heapRegionRemSet.hpp"
  42 #include "gc/shared/gcPolicyCounters.hpp"
  43 #include "logging/logStream.hpp"
  44 #include "runtime/arguments.hpp"
  45 #include "runtime/java.hpp"
  46 #include "runtime/mutexLocker.hpp"
  47 #include "utilities/debug.hpp"
  48 #include "utilities/growableArray.hpp"
  49 #include "utilities/pair.hpp"


1010       log_debug(gc, ergo)("Initiate concurrent cycle (user requested concurrent cycle)");
1011     } else {
1012       // The concurrent marking thread is still finishing up the
1013       // previous cycle. If we start one right now the two cycles
1014       // overlap. In particular, the concurrent marking thread might
1015       // be in the process of clearing the next marking bitmap (which
1016       // we will use for the next cycle if we start one). Starting a
1017       // cycle now will be bad given that parts of the marking
1018       // information might get cleared by the marking thread. And we
1019       // cannot wait for the marking thread to finish the cycle as it
1020       // periodically yields while clearing the next marking bitmap
1021       // and, if it's in a yield point, it's waiting for us to
1022       // finish. So, at this point we will not start a cycle and we'll
1023       // let the concurrent marking thread complete the last one.
1024       log_debug(gc, ergo)("Do not initiate concurrent cycle (concurrent cycle already in progress)");
1025     }
1026   }
1027 }
1028 
1029 void G1Policy::record_concurrent_mark_cleanup_end() {
1030   G1CollectionSetCandidates* candidates = G1CollectionSetChooser::build(_g1h->workers(), _g1h->num_regions());
1031   _collection_set->set_candidates(candidates);
1032 
1033   bool mixed_gc_pending = next_gc_should_be_mixed("request mixed gcs", "request young-only gcs");
1034   if (!mixed_gc_pending) {
1035     clear_collection_set_candidates();
1036     abort_time_to_mixed_tracking();
1037   }
1038   collector_state()->set_in_young_gc_before_mixed(mixed_gc_pending);
1039   collector_state()->set_mark_or_rebuild_in_progress(false);
1040 
1041   double end_sec = os::elapsedTime();
1042   double elapsed_time_ms = (end_sec - _mark_cleanup_start_sec) * 1000.0;
1043   _analytics->report_concurrent_mark_cleanup_times_ms(elapsed_time_ms);
1044   _analytics->append_prev_collection_pause_end_ms(elapsed_time_ms);
1045 
1046   record_pause(Cleanup, _mark_cleanup_start_sec, end_sec);
1047 }
1048 
1049 double G1Policy::reclaimable_bytes_percent(size_t reclaimable_bytes) const {
1050   return percent_of(reclaimable_bytes, _g1h->capacity());


< prev index next >