Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r70103:7ace040eff96
Date: 2014-03-20 08:31 +0100
http://bitbucket.org/pypy/pypy/changeset/7ace040eff96/
Log: import stmgc/0e5239ae07f2
diff --git a/rpython/translator/stm/src_stm/revision
b/rpython/translator/stm/src_stm/revision
--- a/rpython/translator/stm/src_stm/revision
+++ b/rpython/translator/stm/src_stm/revision
@@ -1,1 +1,1 @@
-75893b92af4e
+0e5239ae07f2
diff --git a/rpython/translator/stm/src_stm/stm/contention.c
b/rpython/translator/stm/src_stm/stm/contention.c
--- a/rpython/translator/stm/src_stm/stm/contention.c
+++ b/rpython/translator/stm/src_stm/stm/contention.c
@@ -70,6 +70,14 @@
__attribute__((unused))
static void cm_always_wait_for_other_thread(struct contmgr_s *cm)
{
+ /* we tried this contention management, but it seems to have
+ very bad cases: if thread 1 always reads an object in every
+ transaction, and thread 2 wants to write this object just
+ once, then thread 2 will pause when it tries to commit;
+ it will wait until thread 1 committed; but by the time
+ thread 2 resumes again, thread 1 has already started the
+ next transaction and read the object again.
+ */
cm_abort_the_younger(cm);
cm->try_sleep = true;
}
@@ -111,7 +119,7 @@
#ifdef STM_TESTS
cm_abort_the_younger(&contmgr);
#else
- cm_always_wait_for_other_thread(&contmgr);
+ cm_pause_if_younger(&contmgr);
#endif
/* Fix the choices that are found incorrect due to TS_INEVITABLE
diff --git a/rpython/translator/stm/src_stm/stm/forksupport.c
b/rpython/translator/stm/src_stm/stm/forksupport.c
--- a/rpython/translator/stm/src_stm/stm/forksupport.c
+++ b/rpython/translator/stm/src_stm/stm/forksupport.c
@@ -40,6 +40,7 @@
s_mutex_lock();
dprintf(("forksupport_prepare\n"));
+ fprintf(stderr, "[forking: for now, this operation can take some time]\n");
stm_thread_local_t *this_tl = NULL;
stm_thread_local_t *tl = stm_all_thread_locals;
@@ -143,8 +144,8 @@
fork_was_in_transaction = was_in_transaction;
assert(_has_mutex());
- printf("forksupport_prepare: from %p %p\n", fork_this_tl,
- fork_this_tl->creating_pthread[0]);
+ dprintf(("forksupport_prepare: from %p %p\n", fork_this_tl,
+ fork_this_tl->creating_pthread[0]));
}
static void forksupport_parent(void)
@@ -152,8 +153,8 @@
if (stm_object_pages == NULL)
return;
- printf("forksupport_parent: continuing to run %p %p\n", fork_this_tl,
- fork_this_tl->creating_pthread[0]);
+ dprintf(("forksupport_parent: continuing to run %p %p\n", fork_this_tl,
+ fork_this_tl->creating_pthread[0]));
assert(_has_mutex());
assert(_is_tl_registered(fork_this_tl));
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit