src/share/vm/gc/cms/compactibleFreeListSpace.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/gc/cms

src/share/vm/gc/cms/compactibleFreeListSpace.cpp

Print this page




2500 void CFLS_LAB::get_from_global_pool(size_t word_sz, AdaptiveFreeList<FreeChunk>* fl) {
2501   // Get the #blocks we want to claim
2502   size_t n_blks = (size_t)_blocks_to_claim[word_sz].average();
2503   assert(n_blks > 0, "Error");
2504   assert(ResizeOldPLAB || n_blks == OldPLABSize, "Error");
2505   // In some cases, when the application has a phase change,
2506   // there may be a sudden and sharp shift in the object survival
2507   // profile, and updating the counts at the end of a scavenge
2508   // may not be quick enough, giving rise to large scavenge pauses
2509   // during these phase changes. It is beneficial to detect such
2510   // changes on-the-fly during a scavenge and avoid such a phase-change
2511   // pothole. The following code is a heuristic attempt to do that.
2512   // It is protected by a product flag until we have gained
2513   // enough experience with this heuristic and fine-tuned its behavior.
2514   // WARNING: This might increase fragmentation if we overreact to
2515   // small spikes, so some kind of historical smoothing based on
2516   // previous experience with the greater reactivity might be useful.
2517   // Lacking sufficient experience, CMSOldPLABResizeQuicker is disabled by
2518   // default.
2519   if (ResizeOldPLAB && CMSOldPLABResizeQuicker) {
2520     size_t multiple = _num_blocks[word_sz]/(CMSOldPLABToleranceFactor*CMSOldPLABNumRefills*n_blks);




2521     n_blks +=  CMSOldPLABReactivityFactor*multiple*n_blks;
2522     n_blks = MIN2(n_blks, CMSOldPLABMax);
2523   }
2524   assert(n_blks > 0, "Error");
2525   _cfls->par_get_chunk_of_blocks(word_sz, n_blks, fl);
2526   // Update stats table entry for this block size
2527   _num_blocks[word_sz] += fl->count();
2528 }
2529 
2530 void CFLS_LAB::compute_desired_plab_size() {
2531   for (size_t i =  CompactibleFreeListSpace::IndexSetStart;
2532        i < CompactibleFreeListSpace::IndexSetSize;
2533        i += CompactibleFreeListSpace::IndexSetStride) {
2534     assert((_global_num_workers[i] == 0) == (_global_num_blocks[i] == 0),
2535            "Counter inconsistency");
2536     if (_global_num_workers[i] > 0) {
2537       // Need to smooth wrt historical average
2538       if (ResizeOldPLAB) {
2539         _blocks_to_claim[i].sample(
2540           MAX2(CMSOldPLABMin,




2500 void CFLS_LAB::get_from_global_pool(size_t word_sz, AdaptiveFreeList<FreeChunk>* fl) {
2501   // Get the #blocks we want to claim
2502   size_t n_blks = (size_t)_blocks_to_claim[word_sz].average();
2503   assert(n_blks > 0, "Error");
2504   assert(ResizeOldPLAB || n_blks == OldPLABSize, "Error");
2505   // In some cases, when the application has a phase change,
2506   // there may be a sudden and sharp shift in the object survival
2507   // profile, and updating the counts at the end of a scavenge
2508   // may not be quick enough, giving rise to large scavenge pauses
2509   // during these phase changes. It is beneficial to detect such
2510   // changes on-the-fly during a scavenge and avoid such a phase-change
2511   // pothole. The following code is a heuristic attempt to do that.
2512   // It is protected by a product flag until we have gained
2513   // enough experience with this heuristic and fine-tuned its behavior.
2514   // WARNING: This might increase fragmentation if we overreact to
2515   // small spikes, so some kind of historical smoothing based on
2516   // previous experience with the greater reactivity might be useful.
2517   // Lacking sufficient experience, CMSOldPLABResizeQuicker is disabled by
2518   // default.
2519   if (ResizeOldPLAB && CMSOldPLABResizeQuicker) {
2520     //
2521     // On a 32-bit VM, the denominator can become zero because of integer overflow,
2522     // which is why there is a cast to double.
2523     //
2524     size_t multiple = (size_t) (_num_blocks[word_sz]/(((double)CMSOldPLABToleranceFactor)*CMSOldPLABNumRefills*n_blks));
2525     n_blks +=  CMSOldPLABReactivityFactor*multiple*n_blks;
2526     n_blks = MIN2(n_blks, CMSOldPLABMax);
2527   }
2528   assert(n_blks > 0, "Error");
2529   _cfls->par_get_chunk_of_blocks(word_sz, n_blks, fl);
2530   // Update stats table entry for this block size
2531   _num_blocks[word_sz] += fl->count();
2532 }
2533 
2534 void CFLS_LAB::compute_desired_plab_size() {
2535   for (size_t i =  CompactibleFreeListSpace::IndexSetStart;
2536        i < CompactibleFreeListSpace::IndexSetSize;
2537        i += CompactibleFreeListSpace::IndexSetStride) {
2538     assert((_global_num_workers[i] == 0) == (_global_num_blocks[i] == 0),
2539            "Counter inconsistency");
2540     if (_global_num_workers[i] > 0) {
2541       // Need to smooth wrt historical average
2542       if (ResizeOldPLAB) {
2543         _blocks_to_claim[i].sample(
2544           MAX2(CMSOldPLABMin,


src/share/vm/gc/cms/compactibleFreeListSpace.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File