RFR: 8067785: Using AlwaysPreTouch does not always touch all pages

Per Liden per.liden at oracle.com
Mon Apr 18 09:28:03 UTC 2016


Hi Stefan,

On 2016-04-15 16:13, Stefan Karlsson wrote:
> Hi all,
>
> Please review this patch that ensures that VirtualSpace::expand_by
> pre-touches all committed memory.
>
> http://cr.openjdk.java.net/~stefank/8067785/webrev.01
> https://bugs.openjdk.java.net/browse/JDK-8067785

Looks good.

cheers,
Per

>
> 1) Previously, we pre-touched the memory between the old and new _high
> pointers. Since the _high variable isn't page aligned, the pre-touch
> code didn't touch all committed pages. I've moved the pre-touch code to
> be done for every os::commit_memory call in VirtuaSpace::expand_by.
>
> 2) expand_by has segregated the VirtualSpace into three segements.
> [small pages | large pages | small pages] so that we can have
> VirtualSpaces that are not large page size aligned. Previously, only the
> middle section called commit_memory with an alignment hint, and the
> small pages sections called commit_memory without a small pages hint. On
> all platforms, except Solaris, this boils down to the same code. On
> Solaris we have this additional code executed:
>      size_t page_size = page_size_for_alignment(alignment_hint);
>      if (page_size > (size_t) vm_page_size()) {
>        (void)Solaris::setup_large_pages(addr, bytes, page_size);
>      }
>
> But since the alignment_hint is set to vm_page_size we won't try to
> setup_large_pages here either.
>
> 3) The patch also contains a few style changes to make the
> VirtualSpace::expand_by easier to read (at least for me)
>
> Tested with JPRT and -XX:+ExecuteInternalVMTests with AlwaysPreTouch
> temporarily forced to true.
>
> Thanks,
> StefanK


More information about the hotspot-dev mailing list