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

Print this page




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




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