RFR: 8017629: G1: UseSHM in combination with a G1HeapRegionSize > os::large_page_size() falls back to use small pages

Thomas Stüfe thomas.stuefe at gmail.com
Mon Apr 11 12:39:30 UTC 2016


Hi Stefan,

short question, why the mmap before the shmat? Why not shmat right away at
the requested address?

Also note that mmap- and shmat-allocated memory may have different
alignment requirements: mmap requires a page-aligned request address,
whereas shmat requires alignment to SHMLBA, which may be multiple pages
(e.g. for ARM:
http://lxr.free-electrons.com/source/arch/arm/include/asm/shmparam.h#L9).
So, for this shat-over-mmap trick to work, request address has to be
aligned to SHMLBA, not just page size.

I see that you assert alignment of requ address to os::large_page_size(),
which I would assume is a multiple of SHMLBA, but I am not sure of this.

Kind Regards, Thomas



On Mon, Apr 11, 2016 at 1:03 PM, Stefan Karlsson <stefan.karlsson at oracle.com
> wrote:

> Hi all,
>
> Please review this patch to enable SHM large page allocations even when
> the requested alignment is larger than os::large_page_size().
>
> http://cr.openjdk.java.net/~stefank/8017629/webrev.01
> https://bugs.openjdk.java.net/browse/JDK-8017629
>
> G1 is affected by this bug since it requires the heap to start at an
> address that is aligned with the heap region size. The patch fixes this by
> changing the UseSHM large pages allocation code. First, virtual memory with
> correct alignment is pre-reserved and then the large pages are attached to
> this memory area.
>
> Tested with vm.gc.testlist and ExecuteInternaVMTests
>
> Thanks,
> StefanK
>


More information about the hotspot-dev mailing list