The logging of number of workers used by the young GCs in G1 is wrong.
The code looks like this:
---
uint active_workers = AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
workers()->active_workers(),
Threads::number_of_non_daemon_threads());
workers()->update_active_workers(active_workers);
log_info(gc,task)("Using %u workers of %u for evacuation", active_workers, workers()->total_workers());
---
This looks ok, but if anything goes wrong in when updating the number of active workers the value might not be what is expected. This is easily triggered by using -XX:+UseDynamicNumberOfGCThreads -XX:+UnlockDiagnosticVMOptions -XX:+InjectGCWorkerCreationFailure.
The fix is also simple, just print workers()->active_workers().
The code looks like this:
---
uint active_workers = AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
workers()->active_workers(),
Threads::number_of_non_daemon_threads());
workers()->update_active_workers(active_workers);
log_info(gc,task)("Using %u workers of %u for evacuation", active_workers, workers()->total_workers());
---
This looks ok, but if anything goes wrong in when updating the number of active workers the value might not be what is expected. This is easily triggered by using -XX:+UseDynamicNumberOfGCThreads -XX:+UnlockDiagnosticVMOptions -XX:+InjectGCWorkerCreationFailure.
The fix is also simple, just print workers()->active_workers().