diff options
author | mgerdin <none@none> | 2013-03-28 10:27:28 +0100 |
---|---|---|
committer | mgerdin <none@none> | 2013-03-28 10:27:28 +0100 |
commit | 6afb1220e0d613e190a1a7466607876e98182c15 (patch) | |
tree | 7a8dc682fa544a8e43a3dcb212a9ef319443ffb6 /src/share/vm/memory/collectorPolicy.cpp | |
parent | 02bebe7fb25d0a873b8b71bf8a146fdefcd7775c (diff) |
7014552: gc/lock/jni/jnilockXXX works too slow on 1-processor machine
Summary: Keep a counter of how many times we were stalled by the GC locker, add a diagnostic flag which sets the limit.
Reviewed-by: brutisso, ehelin, johnc
Diffstat (limited to 'src/share/vm/memory/collectorPolicy.cpp')
-rw-r--r-- | src/share/vm/memory/collectorPolicy.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/share/vm/memory/collectorPolicy.cpp b/src/share/vm/memory/collectorPolicy.cpp index d5eb387a0..a2049597a 100644 --- a/src/share/vm/memory/collectorPolicy.cpp +++ b/src/share/vm/memory/collectorPolicy.cpp @@ -532,7 +532,7 @@ HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size, // Loop until the allocation is satisified, // or unsatisfied after GC. - for (int try_count = 1; /* return or throw */; try_count += 1) { + for (int try_count = 1, gclocker_stalled_count = 0; /* return or throw */; try_count += 1) { HandleMark hm; // discard any handles allocated in each iteration // First allocation attempt is lock-free. @@ -576,6 +576,10 @@ HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size, } } + if (gclocker_stalled_count > GCLockerRetryAllocationCount) { + return NULL; // we didn't get to do a GC and we didn't get any memory + } + // If this thread is not in a jni critical section, we stall // the requestor until the critical section has cleared and // GC allowed. When the critical section clears, a GC is @@ -587,6 +591,7 @@ HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size, MutexUnlocker mul(Heap_lock); // Wait for JNI critical section to be exited GC_locker::stall_until_clear(); + gclocker_stalled_count += 1; continue; } else { if (CheckJNICalls) { |