RFR: 8245000: Windows GDI functions don't support large pages

stefan.johansson at oracle.com stefan.johansson at oracle.com
Tue May 19 13:16:32 UTC 2020


Hi Stefan,

On 2020-05-15 19:47, Stefan Karlsson wrote:
> Hi all,
> 
> Please review this patch to turn off -XX:+UseLargePages as long as 
> Windows GDI functions don't work with large pages.
> 
> https://cr.openjdk.java.net/~stefank/8245000/webrev.00.cleanup
> https://cr.openjdk.java.net/~stefank/8245000/webrev.01.workaround
> https://cr.openjdk.java.net/~stefank/8245000/webrev.all/

Thanks for splitting those changes up into cleanup and fix, really makes 
it easy to review.

Looks good,
StefanJ
> 
> The patches build upon the changes in:
> 8245002: Windows GDI functions don't support NUMA interleaving
> https://mail.openjdk.java.net/pipermail/hotspot-dev/2020-May/041798.html
> 
> During the investigation of JDK-8240654 
> <https://bugs.openjdk.java.net/browse/JDK-8240654> it was found that 
> some of the Windows GDI functions don't work with large pages 
> (-XX:+UseLargePages). This causes severe repaint issues.
> 
> The problem can easily be seen with the Java2D demos, where the drawn UI 
> is grayed out instead of containing all relevant components.
> 
> This can be reproduced by running building J2DBench and running:
> java -Xmx1g -Xms1g -XX:+UseLargePages -Dsun.java2d.opengl=False 
> -Dsun.java2d.d3d=False -jar dist/J2DBench.jar
> 
> The -Dsun.java2d.d3d property is used to ensure that that java2d doesn't 
> enable the alternative, D3D implementation instead of GDI. 
> -Dsun.java2d.opengl is turned off for the same reason.
> 
> The cleanup patch simplifies request_lock_memory_privilege and 
> large_page_init, to make it easier to insert the necessary checks.
> 
> The code first checks if memory allocated with large pages can be used 
> by GDI functions. If this check fails it forcefully turns off 
> -XX:+UseLargePages.
> 
> Just like with JDK-8245002, the intention is that as long as the GDI 
> functions can't use large pages, the -XX:+UseLargePages flag will be 
> turned off. If Microsoft changes the GDI code, so that it works with 
> large pages, then the proposed patch will automatically allow the flag 
> to be enabled.
> 
> There's a second case that we need to consider for large pages. If the 
> GDI functions start to allow large pages, we have a flag 
> (-XX:+UseLargePagesIndividualAllocation) that reserves and commits large 
> pages in page-sized granules. This could cause the same 
> multi-reservation problem described in JDK-8245002. I've also added a 
> check for that, and turn off -XX:+UseLargePagesIndividualAllocation if 
> it fails.
> 
> I've run this through tier1-3 and also tested this manually. I've 
> manually turned off the different checks to verify that it turns on the 
> two flags.
> 
> Thanks,
> StefanK


More information about the hotspot-dev mailing list