--- old/src/os/windows/vm/os_windows.cpp 2015-12-16 11:32:55.433423998 -0800 +++ new/src/os/windows/vm/os_windows.cpp 2015-12-16 11:32:55.337424001 -0800 @@ -3415,22 +3415,23 @@ } static bool protect_pages_individually(char* addr, size_t bytes, unsigned int p, DWORD *old_status) { - size_t page_size = UseLargePages ? _large_page_size : os::vm_allocation_granularity(); - size_t chunk_size = UseNUMAInterleaving ? NUMAInterleaveGranularity : page_size; - uint count = 0; bool ret = false; size_t bytes_remaining = bytes; char * next_protect_addr = addr; - // Below split reflects address and size when we reserved the memory by allocate_pages_individually(). + // Use VirtualQuery() to get the chunk size. while (bytes_remaining) { - size_t bytes_to_protect = MIN2(bytes_remaining, chunk_size - ((size_t)next_protect_addr % chunk_size)); + MEMORY_BASIC_INFORMATION alloc_info; + VirtualQuery(next_protect_addr, &alloc_info, sizeof(alloc_info)); + size_t bytes_to_protect = MIN2(bytes_remaining, (size_t)alloc_info.RegionSize); // We used different API at allocate_pages_individually() based on UseNUMAInterleaving, // but we don't distinguish here as both cases are protected by same API. ret = VirtualProtect(next_protect_addr, bytes_to_protect, p, old_status) != 0; - assert(ret, "Failed protecting chunk #" UINT32_FORMAT, count); - if (!ret) return false; + assert(ret, "Failed protecting chunk #%u", count); + if (!ret) { + return false; + } bytes_remaining -= bytes_to_protect; next_protect_addr += bytes_to_protect; --- old/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java 2015-12-16 11:32:56.077423975 -0800 +++ new/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java 2015-12-16 11:32:55.985423979 -0800 @@ -136,12 +136,6 @@ excludeTestMaxRange("VMThreadStackSize"); /* - * JDK-8145027 - * Temporarily exclude as current range/constraint is not enough for some option combinations. - */ - excludeTestRange("NUMAInterleaveGranularity"); - - /* * Remove parameters controlling the code cache. As these * parameters have implications on the physical memory * reserved by the VM, setting them to large values may hang