RFR: 8268127: Shenandoah: Heap size may be too small for region to align to large page size [v4]

Aleksey Shipilev shade at openjdk.java.net
Tue Jun 8 14:09:26 UTC 2021


On Mon, 7 Jun 2021 13:04:41 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

>> TestLargePages.java failed on Linux AArch64, where large page size is 500M, and the test is configured to run with much smaller heap, e.g. 131M.
>> 
>> This is *not* AArch64 specific, just none of our regular test machines has large page setup.
>> 
>> I purpose two invariants:
>> 1) Heap size always aligns up to page size that is requested.
>> 2) Region size always aligns up to page size that is requested if heap is large enough to accommodate them. Otherwise, it aligns up to regular page size.
>> 
>> This partially reverts JDK-8266802.
>> 
>> Obviously, this is a corner case and is unlikely seen in real word. The alternative is to disable UseLargePages if heap size is too small, e.g. align_up(heap_size, page_size) < MIN_NUM_REGIONS.
>> 
>> Test:
>>   hotspot_gc_shenandoah
>
> Zhengyu Gu has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
> 
>  - rkennke's comment
>  - Merge branch 'master' into JDK-8268127-large-page-small-heap
>  - Window build
>  - Fix compilation error
>  - v2
>  - v1

This looks fine to me, modulo nits below. Consider adding new test cases in `gc/shenandoah/TestLargePages.java`. This fails for me on Linux x86_64 (2M large pages by default): `build/linux-x86_64-server-fastdebug/images/jdk/bin/java -XX:+UseShenandoahGC -Xmx16m -XX:+UseLargePages Test`

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp line 183:

> 181: 
> 182:   log_info(gc)("Setup heap, size: " SIZE_FORMAT "K, region size: " SIZE_FORMAT "K and region count: " SIZE_FORMAT,
> 183:               max_byte_size / K, reg_size_bytes / K, _num_regions);

This seems redundant. I think `gc+init` already prints this?

src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp line 559:

> 557:     } else {
> 558:       // Should have been checked during argument initialization
> 559:       assert(!ShenandoahUncommit, "Uncommit requires region size aligns to underline page size");

Assert message: "Uncommit requires region size aligned to large page size"?

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

Marked as reviewed by shade (Reviewer).

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


More information about the hotspot-gc-dev mailing list