--- old/src/hotspot/os/windows/os_windows.cpp 2020-08-26 13:29:31.718125605 +0200 +++ new/src/hotspot/os/windows/os_windows.cpp 2020-08-26 13:29:31.542120996 +0200 @@ -2763,12 +2763,12 @@ // Test if GDI functions work when memory spans // two adjacent memory reservations. -static bool gdi_can_use_split_reservation_memory(bool use_large_pages, size_t granule) { - DWORD mem_large_pages = use_large_pages ? MEM_LARGE_PAGES : 0; +static bool gdi_can_use_split_reservation_memory() { + size_t granule = os::vm_allocation_granularity(); - // Find virtual memory range. Two granules for regions and one for alignment. + // Find virtual memory range void* reserved = VirtualAlloc(NULL, - granule * 3, + granule * 2, MEM_RESERVE, PAGE_NOACCESS); if (reserved == NULL) { @@ -2777,14 +2777,13 @@ } VirtualFreeChecked(reserved, 0, MEM_RELEASE); - // Ensure proper alignment - void* res0 = align_up(reserved, granule); - void* res1 = (char*)res0 + granule; + void* res0 = reserved; + void* res1 = (char*)reserved + granule; // Reserve and commit the first part void* mem0 = VirtualAlloc(res0, granule, - MEM_RESERVE|MEM_COMMIT|mem_large_pages, + MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); if (mem0 != res0) { // Can't proceed with test - pessimistically report false @@ -2794,7 +2793,7 @@ // Reserve and commit the second part void* mem1 = VirtualAlloc(res1, granule, - MEM_RESERVE|MEM_COMMIT|mem_large_pages, + MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); if (mem1 != res1) { VirtualFreeChecked(mem0, 0, MEM_RELEASE); @@ -2916,7 +2915,7 @@ return false; } - if (!gdi_can_use_split_reservation_memory(UseLargePages, min_interleave_granularity)) { + if (!gdi_can_use_split_reservation_memory()) { WARN("Windows GDI cannot handle split reservations."); WARN("...Ignoring UseNUMAInterleaving flag."); return false; @@ -3082,25 +3081,6 @@ size = LargePageSizeInBytes; } - // Now test allocating a page - void* large_page = VirtualAlloc(NULL, - size, - MEM_RESERVE|MEM_COMMIT|MEM_LARGE_PAGES, - PAGE_READWRITE); - if (large_page == NULL) { - WARN("JVM cannot allocate one single large page."); - return 0; - } - - // Detect if GDI can use memory backed by large pages - if (!gdi_can_use_memory(large_page)) { - WARN("JVM cannot use large pages because of bug in Windows GDI."); - return 0; - } - - // Release test page - VirtualFreeChecked(large_page, 0, MEM_RELEASE); - #undef WARN return size; @@ -3121,16 +3101,6 @@ } UseLargePages = _large_page_size != 0; - - if (UseLargePages && UseLargePagesIndividualAllocation) { - if (!gdi_can_use_split_reservation_memory(true /* use_large_pages */, _large_page_size)) { - if (FLAG_IS_CMDLINE(UseLargePagesIndividualAllocation)) { - warning("Windows GDI cannot handle split reservations."); - warning("...Ignoring UseLargePagesIndividualAllocation flag."); - } - UseLargePagesIndividualAllocation = false; - } - } } int os::create_file_for_heap(const char* dir) {