United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6916968 CMS: freeList.cpp:304 assert(_allocation_stats.prevSweep() + ..., "Conservation Principle")
6916968 : CMS: freeList.cpp:304 assert(_allocation_stats.prevSweep() + ..., "Conservation Principle")

Details
Type:
Bug
Submit Date:
2010-01-14
Status:
Closed
Updated Date:
2011-11-25
Project Name:
JDK
Resolved Date:
2011-09-30
Component:
hotspot
OS:
generic
Sub-Component:
gc
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs17
Fixed Versions:
hs22

Related Reports
Backport:
Backport:
Relates:
Relates:
Relates:

Sub Tasks

Description
This assert was introduced recently in 6631166.

Failing test:-

nsk/stress/jni/gclocker/gcl001
runtime/ParallelClassLoading/mixed/combine/forName/mixed_5

                                    

Comments
EVALUATION

See main CR
                                     
2011-09-12
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/f75137faa7fe
                                     
2011-07-08
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/f75137faa7fe
                                     
2011-07-08
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-gc/hotspot/rev/f75137faa7fe
                                     
2011-06-20
SUGGESTED FIX

Here's a preliminary set of diffs for the fix(es):-

diff --git a/src/share/vm/gc_implementation/concurrentMarkSweep/freeList.cpp b/src/share/vm/gc_implementation/concurrentMarkSweep/freeList.cpp
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/freeList.cpp
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/freeList.cpp
@@ -300,8 +300,21 @@
   // dictionary for example, this might be the first block and
   // in that case there would be no place that we could record
   // the stats (which are kept in the block itself).
-  assert(_allocation_stats.prevSweep() + _allocation_stats.splitBirths() + 1   // Total Stock + 1
-          >= _allocation_stats.splitDeaths() + (ssize_t)count(), "Conservation Principle");
+  assert((_allocation_stats.prevSweep() + _allocation_stats.splitBirths()
+          + _allocation_stats.coalBirths() + 1)   // Total Production Stock + 1
+         >= (_allocation_stats.splitDeaths() + _allocation_stats.coalDeaths()
+             + (ssize_t)count()),                // Total Current Stock + depletion
+         err_msg("FreeList " PTR_FORMAT " of size " SIZE_FORMAT
+                 " violates Conservation Principle: "
+                 "_allocation_stats.prevSweep(" SIZE_FORMAT ")"
+                 " + _allocation_stats.splitBirths(" SIZE_FORMAT ")"
+                 " + _allocation_stats.coalBirts(" SIZE_FORMAT ") + 1 >= "
+                 " _allocation_stats.splitDeaths(" SIZE_FORMAT ")"
+                 " _allocation_stats.coalDeaths(" SIZE_FORMAT ")"
+                 " + count(" SSIZE_FORMAT ")",
+                 this, _size, _allocation_stats.prevSweep(), _allocation_stats.splitBirths(),
+                 _allocation_stats.splitBirths(), _allocation_stats.splitDeaths(),
+                 _allocation_stats.coalDeaths(), count()));
 }
 
 void FreeList::assert_proper_lock_protection_work() const {
diff --git a/src/share/vm/gc_implementation/shared/allocationStats.hpp b/src/share/vm/gc_implementation/shared/allocationStats.hpp
--- a/src/share/vm/gc_implementation/shared/allocationStats.hpp
+++ b/src/share/vm/gc_implementation/shared/allocationStats.hpp
@@ -99,14 +99,17 @@
     // vulnerable to noisy glitches. In such cases, we
     // ignore the current sample and use currently available
     // historical estimates.
-    // XXX NEEDS TO BE FIXED
-    // assert(prevSweep() + splitBirths() >= splitDeaths() + (ssize_t)count, "Conservation Principle");
-    //     ^^^^^^^^^^^^^^^^^^^^^^^^^^^    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-    //     "Total Stock"                  "Not used at this block size"
+    assert(prevSweep() + splitBirths() + coalBirths()        // "Total Production Stock"
+           >= splitDeaths() + coalDeaths() + (ssize_t)count, // "Current stock + depletion"
+           "Conservation Principle");
     if (inter_sweep_current > _threshold) {
-      ssize_t demand = prevSweep() - (ssize_t)count + splitBirths() - splitDeaths();
+      ssize_t demand = prevSweep() - (ssize_t)count + splitBirths() + coalBirths()
+                       - splitDeaths() - coalDeaths();
       // XXX NEEDS TO BE FIXED
-      // assert(demand >= 0, "Demand should be non-negative");
+      assert(demand >= 0,
+             err_msg("Demand (" SSIZE_FORMAT ") should be non-negative for "
+                     PTR_FORMAT " (size=" SIZE_FORMAT ")",
+                     demand, this, count));
       // Defensive: adjust for imprecision in event counting
       if (demand < 0) {
         demand = 0;
                                     
2011-06-15
EVALUATION

The "conservation principle" had been incorrectly formulated.
                                     
2011-06-14



Hardware and Software, Engineered to Work Together