The default choice in setup_large_page_type() if set -XX:+UseLargePages only

David Holmes david.holmes at oracle.com
Thu Jul 18 13:08:13 UTC 2019


Hi Patrick,

On 18/07/2019 9:06 pm, Patrick Zhang OS wrote:
> I found a weird "issue" when setting up an env with -XX:+UseLargePages only. I knew later on that at least one of UseHugeTLBFS/UseSHM/UseTransparentHugePages, but in the beginning everything worked well without any warnings. The default choice is UseHugeTLBFS behind this. However when I added -XX:-UseTransparentHugePages, the function got completely disabled and setup_large_page_type() returned false. Is this an expected behavior? or any warnings ought to show in console? If -XX:+UseLargePages is allowed to be specified alone, perhaps disabling the default UseHugeTLBFS choice can be less misleading?

You can see in the logic that if you enable large pages only then it 
configures the other flags for you in the way that makes most sense: try 
UseHugeTLBFS and then UseSHM, but don't try UseTransparentHugePages 
since there are known performance issues with it turned on.

But if you enable large pages and explicitly set/clear at least one of 
the other flags, then it assumes you've set everything yourself as 
needed and only does some basic sanity checks whilst trying select the 
right mode.

I agree it seems odd that explicitly disabling a flag that would be 
disabled anyway changes the behaviour, but you've basically switched 
things from "configure things for me" mode, to "manual" mode by 
specifying any other flag explicitly. As a result explicitly disabling 
any of the flags results in all flags being off.

Cheers,
David

> Thanks for any comments.
> 
> 
> Here is the related source code:
> bool os::Linux::setup_large_page_type(size_t page_size)
> 
> https://hg.openjdk.java.net/jdk/jdk/file/065142ace8e9/src/hotspot/os/linux/os_linux.cpp#l3764
> 
> 
> 
> java -Xmx512m -XX:+PrintFlagsFinal -version (default values)
> 
>       bool UseHugeTLBFS                             = false                                     {product} {default}
> 
>       bool UseLargePages                            = false                                  {pd product} {default}
> 
>       bool UseSHM                                   = false                                     {product} {default}
> 
>       bool UseTransparentHugePages                  = false                                     {product} {default}
> 
> java -Xmx512m -XX:+PrintFlagsFinal -XX:LargePageSizeInBytes=2m -XX:+UseLargePages -version
> 
>       bool UseHugeTLBFS                             = true                                      {product} {command line}
> 
>       bool UseLargePages                            = true                                   {pd product} {command line}
> 
>       bool UseSHM                                   = false                                     {product} {default}
> 
>       bool UseTransparentHugePages                  = false                                     {product} {default}
> 
> java -Xmx512m -XX:+PrintFlagsFinal -XX:LargePageSizeInBytes=2m -XX:+UseLargePages -XX:-UseTransparentHugePages -version
> 
>       bool UseHugeTLBFS                             = false                                     {product} {command line}
> 
>       bool UseLargePages                            = false                                  {pd product} {command line}
> 
>       bool UseSHM                                   = false                                     {product} {default}
> 
>       bool UseTransparentHugePages                  = false                                     {product} {default}
> 
> java -Xmx512m -XX:+PrintFlagsFinal -XX:LargePageSizeInBytes=2m -XX:+UseLargePages -XX:-UseSHM -version
> 
>       bool UseHugeTLBFS                             = false                                     {product} {command line}
> 
>       bool UseLargePages                            = false                                  {pd product} {command line}
> 
>       bool UseSHM                                   = false                                     {product} {default}
> 
>       bool UseTransparentHugePages                  = false                                     {product} {default}
> 
> Regards
> Patrick
> 


More information about the hotspot-dev mailing list