United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-8013791 G1: G1CollectorPolicy::initialize_flags() may set min_alignment > max_alignment
JDK-8013791 : G1: G1CollectorPolicy::initialize_flags() may set min_alignment > max_alignment

Details
Type:
Bug
Submit Date:
2013-05-02
Status:
Closed
Updated Date:
2013-07-26
Project Name:
JDK
Resolved Date:
2013-05-06
Component:
hotspot
OS:
Sub-Component:
gc
CPU:
Priority:
P2
Resolution:
Fixed
Affected Versions:
Fixed Versions:
hs25 (b32)

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:

Sub Tasks

Description
We set min_alignment to the G1 heap region size, but we set max_alignment to the card table alignment.

The max_alignment is used to align the heap up. If the heap region size is larger than the card table alignment we may end up with a heap size that is not aligned to the heap region.

Here is a command line that fails on my machine:

$ java -XX:MaxRAMFraction=10 -XX:+UseG1GC -XX:G1HeapRegionSize=8m -version
Error occurred during initialization of VM
Size of g1 heap (859832320 bytes) must be aligned to 8388608 bytes

The test in Universe::check_alignment() fails even though the heap size was picked ergonomically. This is because the heap size is card table aligned rather than heap region aligned.

ILW=HML -> P2

The simplest workaround is to set the heap size on the command line to a value that is heap region size aligned.
                                    

Comments
Verified: 

alex@alex-ThinkPad-T420:~/jdk1.8.0/bin:1$./java -version
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b85)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b26, mixed mode)

alex@alex-ThinkPad-T420:~/jdk1.8.0/bin:0$./java -XX:MaxRAMFraction=10 -XX:+UseG1GC -XX:G1HeapRegionSize=8m -version
Error occurred during initialization of VM
Size of g1 heap (826277888 bytes) must be aligned to 8388608 bytes

alex@alex-ThinkPad-T420:~/fresh_jdk8/jdk-8-b90-hs25-b32/jdk1.8.0/fastdebug/bin:0$./java -XX:MaxRAMFraction=10 -XX:+UseG1GC -XX:G1HeapRegionSize=8m -version 
java version "1.8.0-ea-fastdebug"
Java(TM) SE Runtime Environment (build 1.8.0-ea-fastdebug-b90)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b32-fastdebug, mixed mode)
                                     
2013-07-09
URL:   http://hg.openjdk.java.net/hsx/hotspot-gc/hotspot/rev/f14063dcd52a
User:  brutisso
Date:  2013-05-06 09:25:17 +0000

                                     
2013-05-06
URL:   http://hg.openjdk.java.net/hsx/hsx25/hotspot/rev/f14063dcd52a
User:  amurillo
Date:  2013-05-10 22:17:21 +0000

                                     
2013-05-11



Hardware and Software, Engineered to Work Together