The default choice in setup_large_page_type() if set -XX:+UseLargePages only
Patrick Zhang OS
patrick at os.amperecomputing.com
Fri Jul 19 03:07:42 UTC 2019
According to the logic, setting "+UseLargePages only" is equivalent to "+UseHugeTLBFS +UseSHM", since UseHugeTLBFS is of the higher priority (to try). What I learnt here is we'd better not set +UseLargePages since explicitly setting any of UseHugeTLBFS/UseSHM/UseTransparentHugePages would implicitly reconfigure it as true/false, while setting -UseLargePages can play a key role to disable all no mater what other three options are used.
Thanks David.
Regards
Patrick
-----Original Message-----
From: David Holmes <david.holmes at oracle.com>
Sent: Thursday, July 18, 2019 9:08 PM
To: Patrick Zhang OS <patrick at os.amperecomputing.com>; 'hotspot-dev at openjdk.java.net' <hotspot-dev at openjdk.java.net>
Subject: Re: The default choice in setup_large_page_type() if set -XX:+UseLargePages only
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/l
> inux/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