Skip to content

Commit 5362ec9

Browse files
committed
8312492: Remove THP sanity checks at VM startup
Reviewed-by: dholmes, coleenp
1 parent e47a84f commit 5362ec9

File tree

3 files changed

+10
-29
lines changed

3 files changed

+10
-29
lines changed

src/hotspot/os/linux/os_linux.cpp

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3563,27 +3563,6 @@ bool os::unguard_memory(char* addr, size_t size) {
35633563
return linux_mprotect(addr, size, PROT_READ|PROT_WRITE);
35643564
}
35653565

3566-
bool os::Linux::transparent_huge_pages_sanity_check(bool warn,
3567-
size_t page_size) {
3568-
bool result = false;
3569-
void *p = mmap(nullptr, page_size * 2, PROT_READ|PROT_WRITE,
3570-
MAP_ANONYMOUS|MAP_PRIVATE,
3571-
-1, 0);
3572-
if (p != MAP_FAILED) {
3573-
void *aligned_p = align_up(p, page_size);
3574-
3575-
result = madvise(aligned_p, page_size, MADV_HUGEPAGE) == 0;
3576-
3577-
munmap(p, page_size * 2);
3578-
}
3579-
3580-
if (warn && !result) {
3581-
warning("TransparentHugePages is not supported by the operating system.");
3582-
}
3583-
3584-
return result;
3585-
}
3586-
35873566
int os::Linux::hugetlbfs_page_size_flag(size_t page_size) {
35883567
if (page_size != HugePages::default_static_hugepage_size()) {
35893568
return (exact_log2(page_size) << MAP_HUGE_SHIFT);
@@ -3715,13 +3694,9 @@ bool os::Linux::setup_large_page_type(size_t page_size) {
37153694
}
37163695

37173696
if (UseTransparentHugePages) {
3718-
bool warn_on_failure = !FLAG_IS_DEFAULT(UseTransparentHugePages);
3719-
if (transparent_huge_pages_sanity_check(warn_on_failure, page_size)) {
3720-
UseHugeTLBFS = false;
3721-
UseSHM = false;
3722-
return true;
3723-
}
3724-
UseTransparentHugePages = false;
3697+
UseHugeTLBFS = false;
3698+
UseSHM = false;
3699+
return true;
37253700
}
37263701

37273702
if (UseHugeTLBFS) {

src/hotspot/os/linux/os_linux.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ class os::Linux {
7676
static GrowableArray<int>* nindex_to_node() { return _nindex_to_node; }
7777

7878
static bool setup_large_page_type(size_t page_size);
79-
static bool transparent_huge_pages_sanity_check(bool warn, size_t pages_size);
8079
static bool hugetlbfs_sanity_check(bool warn, size_t page_size);
8180
static bool shm_hugetlbfs_sanity_check(bool warn, size_t page_size);
8281

test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import jdk.test.lib.process.ProcessTools;
3838

3939
import java.util.ArrayList;
40+
import java.util.Arrays;
4041

4142
public class TestLargePagesFlags {
4243

@@ -299,6 +300,9 @@ public void expect(Flag... expectedFlags) throws Exception {
299300
throw new IllegalStateException("Must run use() before expect()");
300301
}
301302

303+
System.out.println("Using: " + Arrays.toString(useFlags));
304+
System.out.println("Expecting: " + Arrays.toString(expectedFlags));
305+
302306
OutputAnalyzer output = executeNewJVM(useFlags);
303307

304308
for (Flag flag : expectedFlags) {
@@ -381,6 +385,9 @@ public String name() {
381385
public String value() {
382386
return Boolean.toString(value);
383387
}
388+
389+
@Override
390+
public String toString() { return flagString(); }
384391
}
385392

386393
private static interface Flag {

0 commit comments

Comments
 (0)