--- old/src/hotspot/os/posix/os_posix.cpp 2017-10-31 15:49:42.420715547 -0700 +++ new/src/hotspot/os/posix/os_posix.cpp 2017-10-31 15:49:42.150717592 -0700 @@ -53,6 +53,10 @@ #endif #define IS_VALID_PID(p) (p > 0 && p < MAX_PID) +#ifndef MAP_ANONYMOUS + #define MAP_ANONYMOUS MAP_ANON +#endif + #define check_with_errno(check_type, cond, msg) \ do { \ int err = errno; \ @@ -174,10 +178,6 @@ int ret = sigfillset(&set); assert_with_errno(ret == 0, "sigfillset returned error"); - // block all signals while we do the file operation. - ret = pthread_sigmask(SIG_BLOCK, &set, &oldset); - assert_with_errno(ret == 0, "pthread_sigmask returned error"); - // set the file creation mask. mode_t file_mode = S_IRUSR | S_IWUSR; @@ -185,10 +185,7 @@ int fd = mkstemp(fullname); if (fd < 0) { - // reset the signal mask. - ret = pthread_sigmask(SIG_SETMASK, &oldset, NULL); - assert_with_errno(ret == 0, "pthread_sigmask returned error"); - warning("Could not create file for heap"); + warning("Could not create file for heap with template %s", fullname); os::free(fullname); return -1; } @@ -197,10 +194,6 @@ ret = unlink(fullname); assert_with_errno(ret == 0, "unlink returned error"); - // reset the signal mask. - ret = pthread_sigmask(SIG_SETMASK, &oldset, NULL); - assert_with_errno(ret == 0, "pthread_sigmask returned error"); - os::free(fullname); return fd; } @@ -281,31 +274,6 @@ return map_memory_to_dax_file(base, size, fd); } -char* os::attempt_reserve_memory_at(size_t bytes, char* addr, int file_desc) { - - // We would want to use the complex logic in pd_attempt_reserve_memory_at(), especially in Linux. - // So we call pd_attempt_reserve_memory_at() to purely reserve memory - // and then replace the anonymous mapping with file mapping. - // Unfortunately for AIX, we need to pass new bool parameter to pd_attempt_reserve_memory_at() - // to indicate not to use SHM -#if defined(AIX) - char* result = pd_attempt_reserve_memory_at(bytes, addr, file_desc == -1 /*use_SHM*/); -#else - char* result = pd_attempt_reserve_memory_at(bytes, addr); -#endif - if (result != NULL) { - if (file_desc != -1) { - if (replace_existing_mapping_with_dax_file_mapping(result, bytes, file_desc) == NULL) { - vm_exit_during_initialization(err_msg("Error in mapping Java heap at the given filesystem directory")); - } - MemTracker::record_virtual_memory_reserve_and_commit((address)result, bytes, CALLER_PC); - } else { - MemTracker::record_virtual_memory_reserve((address)result, bytes, CALLER_PC); - } - } - return result; -} - // Multiple threads can race in this code, and can remap over each other with MAP_FIXED, // so on posix, unmap the section at the start and at the end of the chunk that we mapped // rather than unmapping and remapping the whole chunk to get requested alignment.