RFR: 8266349: Pass down requested page size to reserve_memory_special

Stefan Johansson sjohanss at openjdk.java.net
Wed May 5 12:57:51 UTC 2021


On Wed, 5 May 2021 10:29:32 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:

> Please review this enhancement that passes the requested page size in `ReservedSpace` down to the OS-layer.
> 
> **Summary**
> After recent refactoring `ReservedSpace` now store the page size used for a reservation. To make this more consistent this change passes down the page size from the `ReservedSpace` down to the OS-layer when using explicit large pages. Currently this is not really needed because we only support one large page size during the lifetime of the JVM, but this will change with PR #1153. That PR will be simpler to implement if the requested page size is passed down from the layers above. 
> 
> **Testing**
> Local testing together with parts of PR #1153. Mach5 tier 1-3

> Very good.
> 

Thanks =)

> This is not only cosmetic but functional, no? Since before we would always os::large_page_size(); now, in the case of ReservedSpace::ReservedSpace(size), we use whatever os::page_size_for_region wants us to use. Lets see if any errors creep up.
> 

I think this should not change functionality. Before I started my refactoring we did not have `ReservedSpace::ReservedSpace(size)` but this function below where the second parameter was optional. As you can see, if no `preferred_page_size` was given we would use `os::page_size_for_region_unaligned(size, 1)` which is what now is done in `ReservedSpace::ReservedSpace(size)`:

ReservedSpace::ReservedSpace(size_t size, size_t preferred_page_size) : _fd_for_heap(-1) {
  bool has_preferred_page_size = preferred_page_size != 0;
  // Want to use large pages where possible and pad with small pages.
  size_t page_size = has_preferred_page_size ? preferred_page_size : os::page_size_for_region_unaligned(size, 1);
  bool large_pages = page_size != (size_t)os::vm_page_size();
  ...


And if we end up with a page size that isn't large we will never get down into `reserve_memory_special(...)`. Does this sound correct, or did I miss your point?

-------------

PR: https://git.openjdk.java.net/jdk/pull/3878


More information about the hotspot-dev mailing list