[pypy-commit] stmgc contention-counter: fixes?

Remi Meier noreply at buildbot.pypy.org
Tue Jan 21 10:14:32 CET 2014


Author: Remi Meier
Branch: contention-counter
Changeset: r652:004e8c4916f3
Date: 2014-01-15 12:24 +0100
http://bitbucket.org/pypy/stmgc/changeset/004e8c4916f3/

Log:	fixes?

diff --git a/c4/demo2.c b/c4/demo2.c
--- a/c4/demo2.c
+++ b/c4/demo2.c
@@ -8,7 +8,7 @@
 #include "fprintcolor.h"
 
 
-#define LIST_LENGTH 200
+#define LIST_LENGTH 4000 
 #define NUMTHREADS  4
 
 
diff --git a/c4/et.c b/c4/et.c
--- a/c4/et.c
+++ b/c4/et.c
@@ -101,7 +101,7 @@
 
 gcptr get_original_of(gcptr P)
 {
-  if (UNLIKELY(!(P->h_tid & GCFLAG_PREBUILT_ORIGINAL)) && P->h_original)
+  if (!(P->h_tid & GCFLAG_PREBUILT_ORIGINAL) && P->h_original)
     return (gcptr)P->h_original;
   return P;
 }
@@ -112,7 +112,7 @@
 
   //g->h_contention += (g->h_contention + 1) << 2;
   revision_t old =  (RPY_STM_CONT_RMA_SAMPLES - 1) * obj->h_contention;
-  old += 1000000;
+  old += 1000;
   obj->h_contention = old / RPY_STM_CONT_RMA_SAMPLES 
     + ((old % RPY_STM_CONT_RMA_SAMPLES) != 0);
 }
@@ -172,6 +172,7 @@
   revision_t v;
 
   d->count_reads++;
+  
   assert(IMPLIES(!(P->h_tid & GCFLAG_OLD), stmgc_is_in_nursery(d, P)));
   assert(G->h_revision != 0);
 
@@ -309,7 +310,8 @@
 
   /* update penalty for reading */
   gcptr o = get_original_of(P);
-  d->penalty += (o->h_contention >> 1) + 1;
+  d->penalty += /* (o->h_contention >> 1) + */ 1;
+  
   return P;
 
  follow_stub:;
@@ -1030,14 +1032,14 @@
      so far.  This should ensure that, assuming the retry does the same
      thing, it will commit just before it reaches the conflicting point.
      Note that we should never *increase* the read length limit here. */
-  limit = d->count_reads;
-  if (limit > d->reads_size_limit_nonatomic) {  /* can occur if atomic */
-      limit = d->reads_size_limit_nonatomic;
-  }
-  if (limit > 0) {
-      limit -= (limit >> 4);
-      d->reads_size_limit_nonatomic = limit;
-  }
+  /* limit = d->count_reads; */
+  /* if (limit > d->reads_size_limit_nonatomic) {  /\* can occur if atomic *\/ */
+  /*     limit = d->reads_size_limit_nonatomic; */
+  /* } */
+  /* if (limit > 0) { */
+  /*     limit -= (limit >> 4); */
+  /*     d->reads_size_limit_nonatomic = limit; */
+  /* } */
 
   AbortPrivateFromProtected(d);
   gcptrlist_clear(&d->list_of_read_objects);
@@ -1160,7 +1162,7 @@
   assert(!g2l_any_entry(&d->public_to_private));
   assert(d->old_thread_local_obj == NULL);
 
-  d->penalty = 0;
+  d->penalty = 1;
   d->count_reads = 1;
   fxcache_clear(&d->recent_reads_cache);
   gcptrlist_clear(&d->abortinfo);
diff --git a/c4/stmsync.c b/c4/stmsync.c
--- a/c4/stmsync.c
+++ b/c4/stmsync.c
@@ -179,13 +179,13 @@
            has configured 'reads_size_limit_nonatomic' to a smaller value.
            When such a shortened transaction succeeds, the next one will
            see its length limit doubled, up to the maximum. */
-        if (counter == 0 && stm_active != 2) {
-            /* unsigned long limit = d->reads_size_limit_nonatomic; */
+        if (/* counter == 0 &&  */stm_active != 2) {
+            unsigned long limit = d->reads_size_limit_nonatomic;
             /* if (limit != 0 && limit < (stm_regular_length_limit >> 1)) */
             /*     limit = (limit << 1) | 1; */
             /* else */
-            /*     limit = stm_regular_length_limit; */
-            /* d->reads_size_limit_nonatomic = limit; */
+                limit = stm_regular_length_limit;
+            d->reads_size_limit_nonatomic = limit;
         }
         if (!d->atomic) {
             stm_begin_transaction(&_jmpbuf, NULL);


More information about the pypy-commit mailing list