Author: Armin Rigo <ar...@tunes.org> Branch: c7-more-segments Changeset: r1024:4ab1f6857a09 Date: 2014-03-15 18:54 +0100 http://bitbucket.org/pypy/stmgc/changeset/4ab1f6857a09/
Log: Complete diff --git a/c7/stm/pages.h b/c7/stm/pages.h --- a/c7/stm/pages.h +++ b/c7/stm/pages.h @@ -15,16 +15,31 @@ last segment that sees this "shared" copy, and so it is actually not shared with anybody else --- i.e. it is private already. + (This means that 'num_segments_sharing_page' is basically just an + optimization. Without it, we might need 'NB_SEGMENTS + 1' copies of + the same data; with it, we can bound the number to 'NB_SEGMENTS'. + This is probably important if NB_SEGMENTS is very small.) + The shared copy of a page is stored in the mmap at the file offset corresponding to the segment 0 offset (with all other segments remapping to the segment 0 offset). Private copies are made in the offset from segment 1 (and if full, more segments afterwards), picking file offsets that are simply the next free ones. This is probably good for long-term memory usage: a major collection looks - for pages that are no-longer-used private copies of some shared page, + for pages that are no-longer-used private copies of some shared page(*), and discard them, remapping the address to the shared page. The pages thus freed are recorded into a free list, and can be reused as the private copies of the following (unrelated) pages. + + (*) an additional subtlety here is that the shared page should not + contain uncommitted changes; if 'num_segments_sharing_page' is 1 this + can occur. + + Note that this page manipulation logic is independent from actually + tracking which objects are uncommitted, which occurs at the level of + segment-relative offsets; and propagating changes during commit, + which is done by copying objects (not pages) to the same offset + relative to a different segment. */ static uint8_t num_segments_sharing_page[NB_PAGES]; _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit