< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp

Print this page




  75   int sleep = ShenandoahControlIntervalMin;
  76 
  77   double last_shrink_time = os::elapsedTime();
  78   double last_sleep_adjust_time = os::elapsedTime();
  79 
  80   // Shrink period avoids constantly polling regions for shrinking.
  81   // Having a period 10x lower than the delay would mean we hit the
  82   // shrinking with lag of less than 1/10-th of true delay.
  83   // ShenandoahUncommitDelay is in msecs, but shrink_period is in seconds.
  84   double shrink_period = (double)ShenandoahUncommitDelay / 1000 / 10;
  85 
  86   ShenandoahCollectorPolicy* policy = heap->shenandoah_policy();
  87   ShenandoahHeuristics* heuristics = heap->heuristics();
  88   while (!in_graceful_shutdown() && !should_terminate()) {
  89     // Figure out if we have pending requests.
  90     bool alloc_failure_pending = _alloc_failure_gc.is_set();
  91     bool explicit_gc_requested = _gc_requested.is_set() &&  is_explicit_gc(_requested_gc_cause);
  92     bool implicit_gc_requested = _gc_requested.is_set() && !is_explicit_gc(_requested_gc_cause);
  93 
  94     // This control loop iteration have seen this much allocations.
  95     size_t allocs_seen = Atomic::xchg<size_t>(0, &_allocs_seen);
  96 
  97     // Choose which GC mode to run in. The block below should select a single mode.
  98     GCMode mode = none;
  99     GCCause::Cause cause = GCCause::_last_gc_cause;
 100     ShenandoahHeap::ShenandoahDegenPoint degen_point = ShenandoahHeap::_degenerated_unset;
 101 
 102     if (alloc_failure_pending) {
 103       // Allocation failure takes precedence: we have to deal with it first thing
 104       log_info(gc)("Trigger: Handle Allocation Failure");
 105 
 106       cause = GCCause::_allocation_failure;
 107 
 108       // Consume the degen point, and seed it with default value
 109       degen_point = _degen_point;
 110       _degen_point = ShenandoahHeap::_degenerated_outside_cycle;
 111 
 112       if (ShenandoahDegeneratedGC && heuristics->should_degenerate_cycle()) {
 113         heuristics->record_allocation_failure_gc();
 114         policy->record_alloc_failure_to_degenerated(degen_point);
 115         mode = stw_degenerated;




  75   int sleep = ShenandoahControlIntervalMin;
  76 
  77   double last_shrink_time = os::elapsedTime();
  78   double last_sleep_adjust_time = os::elapsedTime();
  79 
  80   // Shrink period avoids constantly polling regions for shrinking.
  81   // Having a period 10x lower than the delay would mean we hit the
  82   // shrinking with lag of less than 1/10-th of true delay.
  83   // ShenandoahUncommitDelay is in msecs, but shrink_period is in seconds.
  84   double shrink_period = (double)ShenandoahUncommitDelay / 1000 / 10;
  85 
  86   ShenandoahCollectorPolicy* policy = heap->shenandoah_policy();
  87   ShenandoahHeuristics* heuristics = heap->heuristics();
  88   while (!in_graceful_shutdown() && !should_terminate()) {
  89     // Figure out if we have pending requests.
  90     bool alloc_failure_pending = _alloc_failure_gc.is_set();
  91     bool explicit_gc_requested = _gc_requested.is_set() &&  is_explicit_gc(_requested_gc_cause);
  92     bool implicit_gc_requested = _gc_requested.is_set() && !is_explicit_gc(_requested_gc_cause);
  93 
  94     // This control loop iteration have seen this much allocations.
  95     size_t allocs_seen = Atomic::xchg(&_allocs_seen, (size_t)0);
  96 
  97     // Choose which GC mode to run in. The block below should select a single mode.
  98     GCMode mode = none;
  99     GCCause::Cause cause = GCCause::_last_gc_cause;
 100     ShenandoahHeap::ShenandoahDegenPoint degen_point = ShenandoahHeap::_degenerated_unset;
 101 
 102     if (alloc_failure_pending) {
 103       // Allocation failure takes precedence: we have to deal with it first thing
 104       log_info(gc)("Trigger: Handle Allocation Failure");
 105 
 106       cause = GCCause::_allocation_failure;
 107 
 108       // Consume the degen point, and seed it with default value
 109       degen_point = _degen_point;
 110       _degen_point = ShenandoahHeap::_degenerated_outside_cycle;
 111 
 112       if (ShenandoahDegeneratedGC && heuristics->should_degenerate_cycle()) {
 113         heuristics->record_allocation_failure_gc();
 114         policy->record_alloc_failure_to_degenerated(degen_point);
 115         mode = stw_degenerated;


< prev index next >