2519 n_blks = MIN2(n_blks, CMSOldPLABMax);
2520 }
2521 assert(n_blks > 0, "Error");
2522 _cfls->par_get_chunk_of_blocks(word_sz, n_blks, fl);
2523 // Update stats table entry for this block size
2524 _num_blocks[word_sz] += fl->count();
2525 }
2526
2527 void CompactibleFreeListSpaceLAB::compute_desired_plab_size() {
2528 for (size_t i = CompactibleFreeListSpace::IndexSetStart;
2529 i < CompactibleFreeListSpace::IndexSetSize;
2530 i += CompactibleFreeListSpace::IndexSetStride) {
2531 assert((_global_num_workers[i] == 0) == (_global_num_blocks[i] == 0),
2532 "Counter inconsistency");
2533 if (_global_num_workers[i] > 0) {
2534 // Need to smooth wrt historical average
2535 if (ResizeOldPLAB) {
2536 _blocks_to_claim[i].sample(
2537 MAX2(CMSOldPLABMin,
2538 MIN2(CMSOldPLABMax,
2539 _global_num_blocks[i]/(_global_num_workers[i]*CMSOldPLABNumRefills))));
2540 }
2541 // Reset counters for next round
2542 _global_num_workers[i] = 0;
2543 _global_num_blocks[i] = 0;
2544 log_trace(gc, plab)("[" SIZE_FORMAT "]: " SIZE_FORMAT, i, (size_t)_blocks_to_claim[i].average());
2545 }
2546 }
2547 }
2548
2549 // If this is changed in the future to allow parallel
2550 // access, one would need to take the FL locks and,
2551 // depending on how it is used, stagger access from
2552 // parallel threads to reduce contention.
2553 void CompactibleFreeListSpaceLAB::retire(int tid) {
2554 // We run this single threaded with the world stopped;
2555 // so no need for locks and such.
2556 NOT_PRODUCT(Thread* t = Thread::current();)
2557 assert(Thread::current()->is_VM_thread(), "Error");
2558 for (size_t i = CompactibleFreeListSpace::IndexSetStart;
2559 i < CompactibleFreeListSpace::IndexSetSize;
|
2519 n_blks = MIN2(n_blks, CMSOldPLABMax);
2520 }
2521 assert(n_blks > 0, "Error");
2522 _cfls->par_get_chunk_of_blocks(word_sz, n_blks, fl);
2523 // Update stats table entry for this block size
2524 _num_blocks[word_sz] += fl->count();
2525 }
2526
2527 void CompactibleFreeListSpaceLAB::compute_desired_plab_size() {
2528 for (size_t i = CompactibleFreeListSpace::IndexSetStart;
2529 i < CompactibleFreeListSpace::IndexSetSize;
2530 i += CompactibleFreeListSpace::IndexSetStride) {
2531 assert((_global_num_workers[i] == 0) == (_global_num_blocks[i] == 0),
2532 "Counter inconsistency");
2533 if (_global_num_workers[i] > 0) {
2534 // Need to smooth wrt historical average
2535 if (ResizeOldPLAB) {
2536 _blocks_to_claim[i].sample(
2537 MAX2(CMSOldPLABMin,
2538 MIN2(CMSOldPLABMax,
2539 _global_num_blocks[i]/_global_num_workers[i]/CMSOldPLABNumRefills)));
2540 }
2541 // Reset counters for next round
2542 _global_num_workers[i] = 0;
2543 _global_num_blocks[i] = 0;
2544 log_trace(gc, plab)("[" SIZE_FORMAT "]: " SIZE_FORMAT, i, (size_t)_blocks_to_claim[i].average());
2545 }
2546 }
2547 }
2548
2549 // If this is changed in the future to allow parallel
2550 // access, one would need to take the FL locks and,
2551 // depending on how it is used, stagger access from
2552 // parallel threads to reduce contention.
2553 void CompactibleFreeListSpaceLAB::retire(int tid) {
2554 // We run this single threaded with the world stopped;
2555 // so no need for locks and such.
2556 NOT_PRODUCT(Thread* t = Thread::current();)
2557 assert(Thread::current()->is_VM_thread(), "Error");
2558 for (size_t i = CompactibleFreeListSpace::IndexSetStart;
2559 i < CompactibleFreeListSpace::IndexSetSize;
|