[pypy-commit] stmgc default: fix: must deactivate queues earlier, else major collection will try to look
arigo
noreply at buildbot.pypy.org
Sat Jun 20 17:21:22 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r1881:9ffba4fe03df
Date: 2015-06-20 17:22 +0200
http://bitbucket.org/pypy/stmgc/changeset/9ffba4fe03df/
Log: fix: must deactivate queues earlier, else major collection will try
to look inside them even if the transaction is aborting
diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -1365,7 +1365,8 @@
}
if (STM_PSEGMENT->active_queues)
- queues_deactivate_all(/*at_commit=*/true);
+ queues_deactivate_all(get_priv_segment(STM_SEGMENT->segment_num),
+ /*at_commit=*/true);
invoke_and_clear_user_callbacks(0); /* for commit */
@@ -1476,6 +1477,9 @@
#endif
tl->thread_local_obj = pseg->threadlocal_at_start_of_transaction;
+ if (pseg->active_queues)
+ queues_deactivate_all(pseg, /*at_commit=*/false);
+
/* Set the next nursery_mark: first compute the value that
nursery_mark must have had at the start of the aborted transaction */
@@ -1521,9 +1525,6 @@
if (tl->mem_clear_on_abort)
memset(tl->mem_clear_on_abort, 0, tl->mem_bytes_to_clear_on_abort);
- if (STM_PSEGMENT->active_queues)
- queues_deactivate_all(/*at_commit=*/false);
-
invoke_and_clear_user_callbacks(1); /* for abort */
if (is_abort(STM_SEGMENT->nursery_end)) {
diff --git a/c8/stm/queue.c b/c8/stm/queue.c
--- a/c8/stm/queue.c
+++ b/c8/stm/queue.c
@@ -126,16 +126,21 @@
}
}
-static void queues_deactivate_all(bool at_commit)
+static void queues_deactivate_all(struct stm_priv_segment_info_s *pseg,
+ bool at_commit)
{
- queue_lock_acquire();
+#pragma push_macro("STM_PSEGMENT")
+#pragma push_macro("STM_SEGMENT")
+#undef STM_PSEGMENT
+#undef STM_SEGMENT
+ spinlock_acquire(pseg->active_queues_lock);
bool added_any_old_entries = false;
bool finished_more_tasks = false;
wlog_t *item;
- TREE_LOOP_FORWARD(STM_PSEGMENT->active_queues, item) {
+ TREE_LOOP_FORWARD(pseg->active_queues, item) {
stm_queue_t *queue = (stm_queue_t *)item->addr;
- stm_queue_segment_t *seg = &queue->segs[STM_SEGMENT->segment_num - 1];
+ stm_queue_segment_t *seg = &queue->segs[pseg->pub.segment_num - 1];
queue_entry_t *head, *freehead;
if (at_commit) {
@@ -188,16 +193,17 @@
} TREE_LOOP_END;
- tree_free(STM_PSEGMENT->active_queues);
- STM_PSEGMENT->active_queues = NULL;
+ tree_free(pseg->active_queues);
+ pseg->active_queues = NULL;
- queue_lock_release();
+ spinlock_release(pseg->active_queues_lock);
- assert(_has_mutex());
if (added_any_old_entries)
cond_broadcast(C_QUEUE_OLD_ENTRIES);
if (finished_more_tasks)
cond_broadcast(C_QUEUE_FINISHED_MORE_TASKS);
+#pragma pop_macro("STM_SEGMENT")
+#pragma pop_macro("STM_PSEGMENT")
}
void stm_queue_put(object_t *qobj, stm_queue_t *queue, object_t *newitem)
diff --git a/c8/stm/queue.h b/c8/stm/queue.h
--- a/c8/stm/queue.h
+++ b/c8/stm/queue.h
@@ -1,3 +1,4 @@
-static void queues_deactivate_all(bool at_commit);
+static void queues_deactivate_all(struct stm_priv_segment_info_s *pseg,
+ bool at_commit);
static void collect_active_queues(void); /* minor collections */
static void mark_visit_from_active_queues(void); /* major collections */
More information about the pypy-commit
mailing list