[pypy-commit] stmgc c7: do minor collections before acquiring the exclusive lock on commit

Remi Meier noreply at buildbot.pypy.org
Thu Jan 23 10:07:53 CET 2014


Author: Remi Meier
Branch: c7
Changeset: r671:b5bde85ec52b
Date: 2014-01-23 10:07 +0100
http://bitbucket.org/pypy/stmgc/changeset/b5bde85ec52b/

Log:	do minor collections before acquiring the exclusive lock on commit

diff --git a/c7/core.c b/c7/core.c
--- a/c7/core.c
+++ b/c7/core.c
@@ -321,13 +321,19 @@
 void stm_stop_transaction(void)
 {
     assert(_STM_TL->running_transaction);
+
+    /* do the minor_collection here and not in nursery_on_commit,
+       since here we can still run concurrently with other threads
+       as we don't hold the exclusive lock yet. */
+    _stm_minor_collect();
+
+    /* Some operations require us to have the EXCLUSIVE lock */
     stm_stop_shared_lock();
     stm_start_exclusive_lock();
 
     _STM_TL->jmpbufptr = NULL;          /* cannot abort any more */
 
-    /* do a minor_collection,
-       push uncommitted objects to other threads,
+    /* push uncommitted objects to other threads,
        make completely uncommitted pages SHARED,
     */
     nursery_on_commit();
diff --git a/c7/nursery.c b/c7/nursery.c
--- a/c7/nursery.c
+++ b/c7/nursery.c
@@ -273,7 +273,9 @@
 
 void nursery_on_commit()
 {
-    minor_collect();
+    /* DON'T do a minor_collect. This is already done in
+       the caller (optimization) */
+    /* minor_collect(); */
     
     /* uncommitted objects / partially COMMITTED pages */
     push_uncommitted_to_other_threads();


More information about the pypy-commit mailing list