Mercurial > hg > release > icedtea7-forest-2.4 > hotspot
changeset 5074:291ce272b61e
8026887: Make issues due to failed large pages allocations easier to debug
Reviewed-by: stefank, mcastegr, poonam
author | aeriksso |
---|---|
date | Thu, 31 Oct 2013 16:49:53 +0100 |
parents | 10848efaae50 |
children | db1734313388 |
files | src/os/linux/vm/os_linux.cpp src/os/linux/vm/os_linux.hpp src/share/vm/utilities/vmError.cpp |
diffstat | 3 files changed, 26 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/os/linux/vm/os_linux.cpp Tue Oct 29 09:53:41 2013 -0700 +++ b/src/os/linux/vm/os_linux.cpp Thu Oct 31 16:49:53 2013 +0100 @@ -2696,6 +2696,14 @@ alignment_hint, exec, strerror(err), err); } +static void warn_fail_commit_memory(char* addr, size_t size, + size_t alignment_hint, bool exec, + int err, const char* msg) { + warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT + ", " SIZE_FORMAT ", %d) failed; error='%s' (errno=%d); %s", addr, size, + alignment_hint, exec, strerror(err), err, msg); +} + // NOTE: Linux kernel does not really reserve the pages for us. // All it does is to check if there are enough free pages // left at the time of mmap(). This could be a potential @@ -2746,6 +2754,8 @@ #define MADV_HUGEPAGE 14 #endif +volatile jint os::Linux::num_largepage_commit_fails = 0; + int os::Linux::commit_memory_impl(char* addr, size_t size, size_t alignment_hint, bool exec) { int err; @@ -2770,7 +2780,9 @@ // from the loss. For now, we just issue a warning and we don't // call vm_exit_out_of_memory(). This issue is being tracked by // JBS-8007074. - warn_fail_commit_memory(addr, size, alignment_hint, exec, err); + Atomic::inc(&os::Linux::num_largepage_commit_fails); + warn_fail_commit_memory(addr, size, alignment_hint, exec, err, + "Cannot allocate large pages, falling back to regular pages"); // vm_exit_out_of_memory(size, "committing reserved memory."); } // Fall through and try to use small pages
--- a/src/os/linux/vm/os_linux.hpp Tue Oct 29 09:53:41 2013 -0700 +++ b/src/os/linux/vm/os_linux.hpp Thu Oct 31 16:49:53 2013 +0100 @@ -100,6 +100,7 @@ public: static bool _stack_is_executable; + static volatile jint num_largepage_commit_fails; static void *dlopen_helper(const char *name, char *ebuf, int ebuflen); static void *dll_load_in_vmthread(const char *name, char *ebuf, int ebuflen);
--- a/src/share/vm/utilities/vmError.cpp Tue Oct 29 09:53:41 2013 -0700 +++ b/src/share/vm/utilities/vmError.cpp Thu Oct 31 16:49:53 2013 +0100 @@ -698,6 +698,18 @@ st->cr(); } +#ifdef LINUX + STEP(193, "(printing large pages allocation errors)") + + if (_verbose) { + jint largepage_failures = os::Linux::num_largepage_commit_fails; + if (largepage_failures > 0) { + st->print_cr("Large page allocation failures have occurred " INT32_FORMAT " times", largepage_failures); + st->cr(); + } + } +#endif + STEP(195, "(printing code cache information)" ) if (_verbose && Universe::is_fully_initialized()) {