Author: Armin Rigo <[email protected]>
Branch: c7-more-segments
Changeset: r1025:49e2782f8a0b
Date: 2014-03-15 19:01 +0100
http://bitbucket.org/pypy/stmgc/changeset/49e2782f8a0b/
Log: Kill again 'num_segments_sharing_page' for now; it's just an
additional complication.
diff --git a/c7/stm/pages.h b/c7/stm/pages.h
--- a/c7/stm/pages.h
+++ b/c7/stm/pages.h
@@ -1,39 +1,19 @@
-/* For every page, 'num_segments_sharing_page' stores a number that
- counts the number of segments that share the page. If 0, the page is
- not used so far.
-
- When the page is first initialized, 'num_segments_sharing_page' is
- set to NB_SEGMENTS. When later a segment wants a private copy, it
- looks first in its own 'private_page_mapping' tree, which maps shared
- pages to private copies. If not found, then it proceeds like this:
-
- If 'num_segments_sharing_page' is greater than 1, then it is
- decremented and a private copy of the page is made.
-
- If 'num_segments_sharing_page' is equal to 1, then we know we are the
- 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.)
+/* This handles pages of objects outside the nursery. Every page
+ has a "shared copy" and zero or more "private copies".
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(*),
- 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.
+ picking file offsets that are simply the next free ones. Each
+ segment maintains a tree 'private_page_mapping', which maps shared
+ pages to private copies.
- (*) an additional subtlety here is that the shared page should not
- contain uncommitted changes; if 'num_segments_sharing_page' is 1 this
- can occur.
+ A major collection looks for pages that are no-longer-used private
+ copies, 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.
Note that this page manipulation logic is independent from actually
tracking which objects are uncommitted, which occurs at the level of
@@ -41,7 +21,6 @@
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];
static void _pages_privatize(uintptr_t pagenum, uintptr_t count);
static void pages_initialize_shared(uintptr_t pagenum, uintptr_t count);
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit