33 static uint calculate_nworkers_based_on_ncpus(double cpu_share_in_percent) { |
33 static uint calculate_nworkers_based_on_ncpus(double cpu_share_in_percent) { |
34 return ceil(os::initial_active_processor_count() * cpu_share_in_percent / 100.0); |
34 return ceil(os::initial_active_processor_count() * cpu_share_in_percent / 100.0); |
35 } |
35 } |
36 |
36 |
37 static uint calculate_nworkers_based_on_heap_size(double reserve_share_in_percent) { |
37 static uint calculate_nworkers_based_on_heap_size(double reserve_share_in_percent) { |
38 const int nworkers = ((MaxHeapSize * (reserve_share_in_percent / 100.0)) - ZPageSizeMedium) / ZPageSizeSmall; |
38 const int nworkers = (MaxHeapSize * (reserve_share_in_percent / 100.0)) / ZPageSizeSmall; |
39 return MAX2(nworkers, 1); |
39 return MAX2(nworkers, 1); |
40 } |
40 } |
41 |
41 |
42 static uint calculate_nworkers(double cpu_share_in_percent) { |
42 static uint calculate_nworkers(double cpu_share_in_percent) { |
43 // Cap number of workers so that we never use more than 10% of the max heap |
43 // Cap number of workers so that we don't use more than 2% of the max heap |
44 // for the reserve. This is useful when using small heaps on large machines. |
44 // for the small page reserve. This is useful when using small heaps on |
|
45 // large machines. |
45 return MIN2(calculate_nworkers_based_on_ncpus(cpu_share_in_percent), |
46 return MIN2(calculate_nworkers_based_on_ncpus(cpu_share_in_percent), |
46 calculate_nworkers_based_on_heap_size(10.0)); |
47 calculate_nworkers_based_on_heap_size(2.0)); |
47 } |
48 } |
48 |
49 |
49 uint ZWorkers::calculate_nparallel() { |
50 uint ZWorkers::calculate_nparallel() { |
50 // Use 60% of the CPUs, rounded up. We would like to use as many threads as |
51 // Use 60% of the CPUs, rounded up. We would like to use as many threads as |
51 // possible to increase parallelism. However, using a thread count that is |
52 // possible to increase parallelism. However, using a thread count that is |