aboutsummaryrefslogtreecommitdiff
path: root/src/os/linux
diff options
context:
space:
mode:
authorctornqvi <none@none>2011-02-09 11:08:10 +0100
committerctornqvi <none@none>2011-02-09 11:08:10 +0100
commit8b0c935064273cbcdcfb015603b6c11571ea9d3c (patch)
treef87321cdc62c0cf564d6653a538069fb5285798b /src/os/linux
parent07448de4d94e9b0ae05610db986c5abe7589f6fe (diff)
7014918: Improve core/minidump handling in Hotspot
Summary: Added Minidump support on Windows, enabled large page core dumps when coredump_filter is present and writing out path/rlimit for core dumps. Reviewed-by: poonam, dsamersoff, sla, coleenp
Diffstat (limited to 'src/os/linux')
-rw-r--r--src/os/linux/vm/os_linux.cpp42
1 files changed, 41 insertions, 1 deletions
diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp
index ace16e3fe..6bdcdd216 100644
--- a/src/os/linux/vm/os_linux.cpp
+++ b/src/os/linux/vm/os_linux.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -131,6 +131,7 @@
#define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
#define SEC_IN_NANOSECS 1000000000LL
+#define LARGEPAGES_BIT (1 << 6)
////////////////////////////////////////////////////////////////////////////////
// global variables
julong os::Linux::_physical_memory = 0;
@@ -2817,6 +2818,43 @@ bool os::unguard_memory(char* addr, size_t size) {
return linux_mprotect(addr, size, PROT_READ|PROT_WRITE);
}
+/*
+* Set the coredump_filter bits to include largepages in core dump (bit 6)
+*
+* From the coredump_filter documentation:
+*
+* - (bit 0) anonymous private memory
+* - (bit 1) anonymous shared memory
+* - (bit 2) file-backed private memory
+* - (bit 3) file-backed shared memory
+* - (bit 4) ELF header pages in file-backed private memory areas (it is
+* effective only if the bit 2 is cleared)
+* - (bit 5) hugetlb private memory
+* - (bit 6) hugetlb shared memory
+*/
+static void set_coredump_filter(void) {
+ FILE *f;
+ long cdm;
+
+ if ((f = fopen("/proc/self/coredump_filter", "r+")) == NULL) {
+ return;
+ }
+
+ if (fscanf(f, "%lx", &cdm) != 1) {
+ fclose(f);
+ return;
+ }
+
+ rewind(f);
+
+ if ((cdm & LARGEPAGES_BIT) == 0) {
+ cdm |= LARGEPAGES_BIT;
+ fprintf(f, "%#lx", cdm);
+ }
+
+ fclose(f);
+}
+
// Large page support
static size_t _large_page_size = 0;
@@ -2874,6 +2912,8 @@ bool os::large_page_init() {
_page_sizes[2] = 0;
}
+ set_coredump_filter();
+
// Large page support is available on 2.6 or newer kernel, some vendors
// (e.g. Redhat) have backported it to their 2.4 based distributions.
// We optimistically assume the support is available. If later it turns out