Java Reference
In-Depth Information
If the command completes successfully like that, large pages are set up correctly. If the large
memory configuration is incorrect, a warning is given:
Java HotSpot(TM) Server VM warning: JVM cannot use large page memory
because it does not have enough privilege to lock pages in memory.
Remember that the command will not print an error on a Windows system (such as “home”
versions) that does not support large pages: once the JVM finds out that large pages are not
supported on the OS, it sets the UseLargePages flag to false , regardless of the command-
line setting.
Large page sizes
On most Linux and Windows systems, the OS uses 2 MB large pages, but that number can
vary depending on the operating system configuration.
Strictly speaking, it is the processor that defines the possible page sizes. Most current Intel
and SPARC processors support a number of possible page sizes: 4 KB, 8 KB, 2 MB, 256
MB, and so on. However, the operating system determines which page sizes can actually be
allocated. On Solaris, all processor page sizes are supported, and the JVM is free to allocate
pages of any size. On Linux kernels (at least as of this writing), you can specify which
processor-supported large page size should be used when the kernel is booted, but that is the
only large page size an application can actually allocate. On Windows, the large page size is
fixed (again, at least for now) at 2 MB.
To support Solaris, Java allows the size of the large pages it allocates to be set via the -
XX:LargePageSizeInBytes= N flag. By default, that flag is set to 0, which means that the
JVM should choose a processor-specific large page size.
That flag can be set on all platforms, and there is never any indication that the specified page
size was or was not used. On a Linux system where you are allocating a very large heap, you
might think you should specify -XX:LargePageSizeInBytes=256M to get the best chance of
getting TLB cache hits. You can do that, and the JVM won't complain, but it will still alloc-
ate only 2 MB pages (or whatever page size the kernel is set to support). In fact, it is possible
to specify page sizes that don't make any sense at all, like -
XX:LargePageSizeInBytes=11111 . Because that page size is unavailable, the JVM will
simply use the default large page size for the platform.
So—for now at least—this flag is really useful only on Solaris. On Solaris, choose a different
page size to use larger pages than the default (which is 4 MB on SPARC processors). On sys-
Search WWH ::




Custom Search