RFR: Fix evac-locking math

Aleksey Shipilev shade at redhat.com
Mon Jun 29 09:23:26 UTC 2020


This is destined to sh/jdk sandbox.

I believe current sizing math mismatches the intent. We already compute bitmap index from the *word
size*, which means shifting that to LogHeapWordSize is incorrect. What we have now in the sandbox is
actually 2^3 = 8 heap words per lock bit.

This reflects it better:

--- a/src/hotspot/share/gc/shenandoah/shenandoahEvacLockingBitmap.hpp   Tue Jun 23 18:07:20 2020 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahEvacLockingBitmap.hpp   Mon Jun 29 11:12:00 2020 +0200
@@ -44,19 +44,19 @@
  */
 class ShenandoahEvacLockingBitmap : public CHeapObj<mtGC> {
 private:
   MemRegion _covered;    // The heap area covered by this bitmap.
   const int _shifter;    // Shift amount from heap index to bit index in the bitmap.
-  CHeapBitMap _bm;        // The actual bitmap.
+  CHeapBitMap _bm;       // The actual bitmap.

   // Convert from address to bit offset.
   inline size_t addr_to_offset(const HeapWord* addr) const;

 public:
   ShenandoahEvacLockingBitmap(MemRegion heap) :
   _covered(heap),
-  _shifter((1 + ShenandoahEvacLockGranularity) * LogHeapWordSize),
+  _shifter(ShenandoahEvacLockGranularity),
   _bm(_covered.word_size() >> _shifter, mtGC) {
 }

   inline void acquire(oop obj);
   inline void release(oop obj);
diff -r aeb9d445884d src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp
--- a/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp    Tue Jun 23 18:07:20 2020 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp    Mon Jun 29 11:12:00 2020 +0200
@@ -320,14 +320,16 @@
                                                                             \
   experimental(uintx, ShenandoahSATBBufferFlushInterval, 100,               \
           "Forcefully flush non-empty SATB buffers at this interval. "      \
           "Time is in milliseconds.")                                       \
                                                                             \
-  experimental(uintx, ShenandoahEvacLockGranularity, 0,                     \
-          "How coarse to make evac-locking. Default 0 means "               \
-          "per-HeapWord-locking, higher value make locking coarser "        \
-          "in 2-exponent steps, e.g. one lock per 2^N heap words.")         \
+  experimental(uintx, ShenandoahEvacLockGranularity, 3,                     \
+          "Defines the coarseness of evac-locking bitmap. Measured in "     \
+          "power-of-two steps. Zero means per-HeapWord-locking, default 3 " \
+          "means one lock per 2^3 = 8 heap words. Larger values improve "   \
+          "native footprint at expense of more potential contention during "\
+          "evacuation.")                                                    \
                                                                             \
   diagnostic(bool, ShenandoahPreclean, true,                                \
           "Do concurrent preclean phase before final mark: process "        \
           "definitely alive references to avoid dealing with them during "  \
           "pause.")                                                         \

Testing: hotspot_gc_shenandoah

-- 
Thanks,
-Aleksey



More information about the shenandoah-dev mailing list