src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp

Print this page




2642   size_t n_blks = (size_t)_blocks_to_claim[word_sz].average();
2643   assert(n_blks > 0, "Error");
2644   assert(ResizePLAB || n_blks == OldPLABSize, "Error");
2645   // In some cases, when the application has a phase change,
2646   // there may be a sudden and sharp shift in the object survival
2647   // profile, and updating the counts at the end of a scavenge
2648   // may not be quick enough, giving rise to large scavenge pauses
2649   // during these phase changes. It is beneficial to detect such
2650   // changes on-the-fly during a scavenge and avoid such a phase-change
2651   // pothole. The following code is a heuristic attempt to do that.
2652   // It is protected by a product flag until we have gained
2653   // enough experience with this heuristic and fine-tuned its behavior.
2654   // WARNING: This might increase fragmentation if we overreact to
2655   // small spikes, so some kind of historical smoothing based on
2656   // previous experience with the greater reactivity might be useful.
2657   // Lacking sufficient experience, CMSOldPLABResizeQuicker is disabled by
2658   // default.
2659   if (ResizeOldPLAB && CMSOldPLABResizeQuicker) {
2660     size_t multiple = _num_blocks[word_sz]/(CMSOldPLABToleranceFactor*CMSOldPLABNumRefills*n_blks);
2661     n_blks +=  CMSOldPLABReactivityFactor*multiple*n_blks;
2662     n_blks = MIN2(n_blks, CMSOldPLABMax);
2663   }
2664   assert(n_blks > 0, "Error");
2665   _cfls->par_get_chunk_of_blocks(word_sz, n_blks, fl);
2666   // Update stats table entry for this block size
2667   _num_blocks[word_sz] += fl->count();
2668 }
2669 
2670 void CFLS_LAB::compute_desired_plab_size() {
2671   for (size_t i =  CompactibleFreeListSpace::IndexSetStart;
2672        i < CompactibleFreeListSpace::IndexSetSize;
2673        i += CompactibleFreeListSpace::IndexSetStride) {
2674     assert((_global_num_workers[i] == 0) == (_global_num_blocks[i] == 0),
2675            "Counter inconsistency");
2676     if (_global_num_workers[i] > 0) {
2677       // Need to smooth wrt historical average
2678       if (ResizeOldPLAB) {
2679         _blocks_to_claim[i].sample(
2680           MAX2((size_t)CMSOldPLABMin,
2681           MIN2((size_t)CMSOldPLABMax,
2682                _global_num_blocks[i]/(_global_num_workers[i]*CMSOldPLABNumRefills))));




2642   size_t n_blks = (size_t)_blocks_to_claim[word_sz].average();
2643   assert(n_blks > 0, "Error");
2644   assert(ResizePLAB || n_blks == OldPLABSize, "Error");
2645   // In some cases, when the application has a phase change,
2646   // there may be a sudden and sharp shift in the object survival
2647   // profile, and updating the counts at the end of a scavenge
2648   // may not be quick enough, giving rise to large scavenge pauses
2649   // during these phase changes. It is beneficial to detect such
2650   // changes on-the-fly during a scavenge and avoid such a phase-change
2651   // pothole. The following code is a heuristic attempt to do that.
2652   // It is protected by a product flag until we have gained
2653   // enough experience with this heuristic and fine-tuned its behavior.
2654   // WARNING: This might increase fragmentation if we overreact to
2655   // small spikes, so some kind of historical smoothing based on
2656   // previous experience with the greater reactivity might be useful.
2657   // Lacking sufficient experience, CMSOldPLABResizeQuicker is disabled by
2658   // default.
2659   if (ResizeOldPLAB && CMSOldPLABResizeQuicker) {
2660     size_t multiple = _num_blocks[word_sz]/(CMSOldPLABToleranceFactor*CMSOldPLABNumRefills*n_blks);
2661     n_blks +=  CMSOldPLABReactivityFactor*multiple*n_blks;
2662     n_blks = MIN2(n_blks, (size_t)CMSOldPLABMax);
2663   }
2664   assert(n_blks > 0, "Error");
2665   _cfls->par_get_chunk_of_blocks(word_sz, n_blks, fl);
2666   // Update stats table entry for this block size
2667   _num_blocks[word_sz] += fl->count();
2668 }
2669 
2670 void CFLS_LAB::compute_desired_plab_size() {
2671   for (size_t i =  CompactibleFreeListSpace::IndexSetStart;
2672        i < CompactibleFreeListSpace::IndexSetSize;
2673        i += CompactibleFreeListSpace::IndexSetStride) {
2674     assert((_global_num_workers[i] == 0) == (_global_num_blocks[i] == 0),
2675            "Counter inconsistency");
2676     if (_global_num_workers[i] > 0) {
2677       // Need to smooth wrt historical average
2678       if (ResizeOldPLAB) {
2679         _blocks_to_claim[i].sample(
2680           MAX2((size_t)CMSOldPLABMin,
2681           MIN2((size_t)CMSOldPLABMax,
2682                _global_num_blocks[i]/(_global_num_workers[i]*CMSOldPLABNumRefills))));