mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
7040485: Use transparent huge page on linux by default
Turn on UseLargePages by default but try only HugeTLBFS method if it is not explicitly specified on the command line. Reviewed-by: ysr
This commit is contained in:
parent
5b3550c107
commit
2abb1bbd58
5 changed files with 20 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
// Defines Linux-specific default values. The flags are available on all
|
// Defines Linux-specific default values. The flags are available on all
|
||||||
// platforms, but they may have different default values on other platforms.
|
// platforms, but they may have different default values on other platforms.
|
||||||
//
|
//
|
||||||
define_pd_global(bool, UseLargePages, false);
|
define_pd_global(bool, UseLargePages, true);
|
||||||
define_pd_global(bool, UseLargePagesIndividualAllocation, false);
|
define_pd_global(bool, UseLargePagesIndividualAllocation, false);
|
||||||
define_pd_global(bool, UseOSErrorReporting, false);
|
define_pd_global(bool, UseOSErrorReporting, false);
|
||||||
define_pd_global(bool, UseThreadPriorities, true) ;
|
define_pd_global(bool, UseThreadPriorities, true) ;
|
||||||
|
|
|
@ -2914,17 +2914,22 @@ static void set_coredump_filter(void) {
|
||||||
|
|
||||||
static size_t _large_page_size = 0;
|
static size_t _large_page_size = 0;
|
||||||
|
|
||||||
bool os::large_page_init() {
|
void os::large_page_init() {
|
||||||
if (!UseLargePages) {
|
if (!UseLargePages) {
|
||||||
UseHugeTLBFS = false;
|
UseHugeTLBFS = false;
|
||||||
UseSHM = false;
|
UseSHM = false;
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FLAG_IS_DEFAULT(UseHugeTLBFS) && FLAG_IS_DEFAULT(UseSHM)) {
|
if (FLAG_IS_DEFAULT(UseHugeTLBFS) && FLAG_IS_DEFAULT(UseSHM)) {
|
||||||
// Our user has not expressed a preference, so we'll try both.
|
// If UseLargePages is specified on the command line try both methods,
|
||||||
|
// if it's default, then try only HugeTLBFS.
|
||||||
|
if (FLAG_IS_DEFAULT(UseLargePages)) {
|
||||||
|
UseHugeTLBFS = true;
|
||||||
|
} else {
|
||||||
UseHugeTLBFS = UseSHM = true;
|
UseHugeTLBFS = UseSHM = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (LargePageSizeInBytes) {
|
if (LargePageSizeInBytes) {
|
||||||
_large_page_size = LargePageSizeInBytes;
|
_large_page_size = LargePageSizeInBytes;
|
||||||
|
@ -2978,7 +2983,6 @@ bool os::large_page_init() {
|
||||||
_page_sizes[1] = default_page_size;
|
_page_sizes[1] = default_page_size;
|
||||||
_page_sizes[2] = 0;
|
_page_sizes[2] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
UseHugeTLBFS = UseHugeTLBFS &&
|
UseHugeTLBFS = UseHugeTLBFS &&
|
||||||
Linux::hugetlbfs_sanity_check(warn_on_failure, _large_page_size);
|
Linux::hugetlbfs_sanity_check(warn_on_failure, _large_page_size);
|
||||||
|
|
||||||
|
@ -2988,12 +2992,6 @@ bool os::large_page_init() {
|
||||||
UseLargePages = UseHugeTLBFS || UseSHM;
|
UseLargePages = UseHugeTLBFS || UseSHM;
|
||||||
|
|
||||||
set_coredump_filter();
|
set_coredump_filter();
|
||||||
|
|
||||||
// Large page support is available on 2.6 or newer kernel, some vendors
|
|
||||||
// (e.g. Redhat) have backported it to their 2.4 based distributions.
|
|
||||||
// We optimistically assume the support is available. If later it turns out
|
|
||||||
// not true, VM will automatically switch to use regular page size.
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SHM_HUGETLB
|
#ifndef SHM_HUGETLB
|
||||||
|
@ -4118,7 +4116,7 @@ jint os::init_2(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
FLAG_SET_DEFAULT(UseLargePages, os::large_page_init());
|
os::large_page_init();
|
||||||
|
|
||||||
// initialize suspend/resume support - must do this before signal_sets_init()
|
// initialize suspend/resume support - must do this before signal_sets_init()
|
||||||
if (SR_initialize() != 0) {
|
if (SR_initialize() != 0) {
|
||||||
|
|
|
@ -3336,11 +3336,11 @@ bool os::Solaris::mpss_sanity_check(bool warn, size_t * page_size) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool os::large_page_init() {
|
void os::large_page_init() {
|
||||||
if (!UseLargePages) {
|
if (!UseLargePages) {
|
||||||
UseISM = false;
|
UseISM = false;
|
||||||
UseMPSS = false;
|
UseMPSS = false;
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// print a warning if any large page related flag is specified on command line
|
// print a warning if any large page related flag is specified on command line
|
||||||
|
@ -3361,7 +3361,6 @@ bool os::large_page_init() {
|
||||||
Solaris::mpss_sanity_check(warn_on_failure, &_large_page_size);
|
Solaris::mpss_sanity_check(warn_on_failure, &_large_page_size);
|
||||||
|
|
||||||
UseLargePages = UseISM || UseMPSS;
|
UseLargePages = UseISM || UseMPSS;
|
||||||
return UseLargePages;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool os::Solaris::set_mpss_range(caddr_t start, size_t bytes, size_t align) {
|
bool os::Solaris::set_mpss_range(caddr_t start, size_t bytes, size_t align) {
|
||||||
|
@ -4992,7 +4991,7 @@ jint os::init_2(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
FLAG_SET_DEFAULT(UseLargePages, os::large_page_init());
|
os::large_page_init();
|
||||||
|
|
||||||
// Check minimum allowable stack size for thread creation and to initialize
|
// Check minimum allowable stack size for thread creation and to initialize
|
||||||
// the java system classes, including StackOverflowError - depends on page
|
// the java system classes, including StackOverflowError - depends on page
|
||||||
|
|
|
@ -2762,8 +2762,8 @@ static void cleanup_after_large_page_init() {
|
||||||
_hToken = NULL;
|
_hToken = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool os::large_page_init() {
|
void os::large_page_init() {
|
||||||
if (!UseLargePages) return false;
|
if (!UseLargePages) return;
|
||||||
|
|
||||||
// print a warning if any large page related flag is specified on command line
|
// print a warning if any large page related flag is specified on command line
|
||||||
bool warn_on_failure = !FLAG_IS_DEFAULT(UseLargePages) ||
|
bool warn_on_failure = !FLAG_IS_DEFAULT(UseLargePages) ||
|
||||||
|
@ -2808,7 +2808,7 @@ bool os::large_page_init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup_after_large_page_init();
|
cleanup_after_large_page_init();
|
||||||
return success;
|
UseLargePages = success;
|
||||||
}
|
}
|
||||||
|
|
||||||
// On win32, one cannot release just a part of reserved memory, it's an
|
// On win32, one cannot release just a part of reserved memory, it's an
|
||||||
|
@ -3561,7 +3561,7 @@ jint os::init_2(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
FLAG_SET_DEFAULT(UseLargePages, os::large_page_init());
|
os::large_page_init();
|
||||||
|
|
||||||
// Setup Windows Exceptions
|
// Setup Windows Exceptions
|
||||||
|
|
||||||
|
|
|
@ -274,7 +274,7 @@ class os: AllStatic {
|
||||||
static char* reserve_memory_special(size_t size, char* addr = NULL,
|
static char* reserve_memory_special(size_t size, char* addr = NULL,
|
||||||
bool executable = false);
|
bool executable = false);
|
||||||
static bool release_memory_special(char* addr, size_t bytes);
|
static bool release_memory_special(char* addr, size_t bytes);
|
||||||
static bool large_page_init();
|
static void large_page_init();
|
||||||
static size_t large_page_size();
|
static size_t large_page_size();
|
||||||
static bool can_commit_large_page_memory();
|
static bool can_commit_large_page_memory();
|
||||||
static bool can_execute_large_page_memory();
|
static bool can_execute_large_page_memory();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue