Mercurial > hg > truffle
diff src/os/linux/vm/os_linux.cpp @ 3318:188c9a5d6a6d
7040485: Use transparent huge page on linux by default
Summary: Turn on UseLargePages by default but try only HugeTLBFS method if it is not explicitly specified on the command line.
Reviewed-by: ysr
author | iveresov |
---|---|
date | Fri, 29 Apr 2011 12:39:32 -0700 |
parents | c303b3532d4a |
children | 97b64f73103b |
line wrap: on
line diff
--- a/src/os/linux/vm/os_linux.cpp Thu Apr 28 15:29:18 2011 -0700 +++ b/src/os/linux/vm/os_linux.cpp Fri Apr 29 12:39:32 2011 -0700 @@ -2914,16 +2914,21 @@ static size_t _large_page_size = 0; -bool os::large_page_init() { +void os::large_page_init() { if (!UseLargePages) { UseHugeTLBFS = false; UseSHM = false; - return false; + return; } if (FLAG_IS_DEFAULT(UseHugeTLBFS) && FLAG_IS_DEFAULT(UseSHM)) { - // Our user has not expressed a preference, so we'll try both. - UseHugeTLBFS = UseSHM = true; + // 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; + } } if (LargePageSizeInBytes) { @@ -2978,7 +2983,6 @@ _page_sizes[1] = default_page_size; _page_sizes[2] = 0; } - UseHugeTLBFS = UseHugeTLBFS && Linux::hugetlbfs_sanity_check(warn_on_failure, _large_page_size); @@ -2988,12 +2992,6 @@ UseLargePages = UseHugeTLBFS || UseSHM; 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 @@ -4118,7 +4116,7 @@ #endif } - FLAG_SET_DEFAULT(UseLargePages, os::large_page_init()); + os::large_page_init(); // initialize suspend/resume support - must do this before signal_sets_init() if (SR_initialize() != 0) {