[pypy-commit] stmgc c8-reshare-pages: do not check for safepoint in the become_inev(DONT_WAIT) case

Raemi pypy.commits at gmail.com
Mon Mar 19 10:43:24 EDT 2018


Author: Remi Meier <remi.meier at gmail.com>
Branch: c8-reshare-pages
Changeset: r2155:ed6411636c6f
Date: 2018-03-19 15:42 +0100
http://bitbucket.org/pypy/stmgc/changeset/ed6411636c6f/

Log:	do not check for safepoint in the become_inev(DONT_WAIT) case

	there is a deadlock if stm_next_to_finalize() calls
	become_inevitable while keeping the g_finalizers.lock; and
	_commit_finalizers() just spins while trying to acquire it. In that
	case, the second thread will not enter a safepoint ever, so all
	other threads are waiting. This commit *should* fix it by really not
	waiting in become_inevitable when DONT_SLEEP is passed as the
	option.

diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -1594,9 +1594,9 @@
 
  retry_from_start:
     assert(STM_PSEGMENT->transaction_state == TS_REGULAR);
-    _stm_collectable_safe_point();
 
     if (msg != MSG_INEV_DONT_SLEEP) {
+        _stm_collectable_safe_point();
         dprintf(("become_inevitable: %s\n", msg));
 
         if (any_soon_finished_or_inevitable_thread_segment() &&


More information about the pypy-commit mailing list