When reserving memory for the CodeCache, we take the minimum page size that fits both InitialCodeCacheSize and ReservedCodeCacheSize:
const size_t page_size = os::can_execute_large_page_memory() ?
MIN2(os::page_size_for_region_aligned(InitialCodeCacheSize, 8),
os::page_size_for_region_aligned(size, 8)) :
os::vm_page_size();
Since ReservedCodeCacheSize is typically quite small, this might lead to decisions to use smaller pages than optimal and setting ReservedCodeCacheSize to a large value might be necessary for some workloads. Perhaps ReservedCodeCacheSize should be ignored when determining what pages to use.
Additionally, at least for 64-bit systems seems we should consider aligning the VirtualSpace with the large pages memory pages and question padding the "middle" (large page-using) region with a lower and upper region that are filled with default pages.
const size_t page_size = os::can_execute_large_page_memory() ?
MIN2(os::page_size_for_region_aligned(InitialCodeCacheSize, 8),
os::page_size_for_region_aligned(size, 8)) :
os::vm_page_size();
Since ReservedCodeCacheSize is typically quite small, this might lead to decisions to use smaller pages than optimal and setting ReservedCodeCacheSize to a large value might be necessary for some workloads. Perhaps ReservedCodeCacheSize should be ignored when determining what pages to use.
Additionally, at least for 64-bit systems seems we should consider aligning the VirtualSpace with the large pages memory pages and question padding the "middle" (large page-using) region with a lower and upper region that are filled with default pages.
- duplicates
-
JDK-8087339 The code heap might use different alignment for committed size and reserved size
- Resolved