[pypy-commit] stmgc c8-reshare-pages: add some comments

Raemi pypy.commits at gmail.com
Sun Mar 18 11:01:48 EDT 2018


Author: Remi Meier <remi.meier at gmail.com>
Branch: c8-reshare-pages
Changeset: r2154:9e9180b5bdf3
Date: 2018-03-18 16:01 +0100
http://bitbucket.org/pypy/stmgc/changeset/9e9180b5bdf3/

Log:	add some comments

diff --git a/c8/TODO b/c8/TODO
--- a/c8/TODO
+++ b/c8/TODO
@@ -1,3 +1,10 @@
+- MOVNTI for non-temporal 32bit store (for read markers)
+- do we actually know if paying the cost of getting the current read-version
+  in every stm_read is lower than paying the cost of zeroing the readmarker
+  on every commit (and just use a flag)?
+
+- stm_enable_atomic() simply sets a huge value for nursery_mark, which is
+  unreliable in theory
 
 - investigate if userfaultfd() helps:
   http://kernelnewbies.org/Linux_4.3#head-3deefea7b0add8c1b171b0e72ce3b69c5ed35cb0
diff --git a/c8/doc/page-resharing.md b/c8/doc/page-resharing.md
--- a/c8/doc/page-resharing.md
+++ b/c8/doc/page-resharing.md
@@ -51,14 +51,14 @@
 
 In signal handler:
 
-    if read or write:
+    if is_read or is_write:
       if is `RO`:
         `RO -> ACC` (and `RO -> NOACC` for all others)
       else if is `NOACC`:
         if !is_write and noone has `ACC`:
           `NOACC -> RO`
         else:
-          `NOACC -> ACC`
+          `NOACC -> ACC` (and `RO -> NOACC` for all others)
 
 On validate: always imports into `ACC`, into `RO` would be a bug.
 
@@ -66,6 +66,10 @@
 
  1. Validation of seg0: gets all changes; any `RO` views still around means that
     there was *no change* in those pages, so the views stay valid.
+    
+    XXX: what about the modifications that major GC makes during tracing? how
+    does it affect the page-sharing in the kernel?
+    
  2. All other segments validate their `ACC` pages; again `RO` pages *cannot*
     have changes that need importing.
  3. While tracing modified objs and overflow objs, remember pages with
diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -235,6 +235,7 @@
             cl = first_cl;
             while ((cl = cl->next) != NULL) {
                 if (!needs_abort) {
+                    /* check if there is a conflict: */
                     struct stm_undo_s *undo = cl->written;
                     struct stm_undo_s *end = cl->written + cl->written_count;
                     for (; undo < end; undo++) {
@@ -301,6 +302,7 @@
                 }
 
                 if (cl->written_count) {
+                    /* copy most recent version of modified objs to our segment: */
                     struct stm_undo_s *undo = cl->written;
                     struct stm_undo_s *end = cl->written + cl->written_count;
 
@@ -314,6 +316,13 @@
                     copy_bk_objs_in_page_from
                         (cl->segment_num, -1,     /* any page */
                          !needs_abort);  /* if we abort, we still want to copy everything */
+
+                    /* reason we must always update to the last (non-INEV)
+                     * commit log entry: a currently running transaction in
+                     * segment_num may have backup copies that revert the
+                     * objects in cl->written to a more current revision than
+                     * the cl-entry represents. This is fine as long as we
+                     * *also* validate to that more current revision. */
                 }
 
                 dprintf(("_stm_validate() to cl=%p, rev=%lu\n", cl, cl->rev_num));


More information about the pypy-commit mailing list