[pypy-commit] stmgc default: Only acquire the mutex_pages_lock if there are really objects to free
arigo
noreply at buildbot.pypy.org
Wed Feb 26 23:51:22 CET 2014
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r885:39c5f170d4d1
Date: 2014-02-26 23:45 +0100
http://bitbucket.org/pypy/stmgc/changeset/39c5f170d4d1/
Log: Only acquire the mutex_pages_lock if there are really objects to
free
diff --git a/c7/stm/nursery.c b/c7/stm/nursery.c
--- a/c7/stm/nursery.c
+++ b/c7/stm/nursery.c
@@ -209,15 +209,20 @@
/* free any object left from 'young_outside_nursery' */
if (!tree_is_cleared(STM_PSEGMENT->young_outside_nursery)) {
- mutex_pages_lock();
-
+ bool locked = false;
wlog_t *item;
TREE_LOOP_FORWARD(*STM_PSEGMENT->young_outside_nursery, item) {
+ if (!locked) {
+ mutex_pages_lock();
+ locked = true;
+ }
_stm_large_free(stm_object_pages + item->addr);
} TREE_LOOP_END;
+ if (locked)
+ mutex_pages_unlock();
+
tree_clear(STM_PSEGMENT->young_outside_nursery);
- mutex_pages_unlock();
}
}
More information about the pypy-commit
mailing list